public void SumAbsDiffUTest(int test, float expected) { float[] src = (float[])testArrays[test].Clone(); var actual = CpuMathUtils.SumAbs(DEFAULT_SCALE, src, 0, src.Length); Assert.Equal(expected, actual, 2); }
public void SumAbsUTest(int test, float expected) { float[] src = (float[])_testArrays[test].Clone(); var actual = CpuMathUtils.SumAbs(src, src.Length); Assert.Equal(expected, actual, 2); }
public void SumAbsDiffUTest(int test, float expected) { float[] src = (float[])_testArrays[test].Clone(); var actual = CpuMathUtils.SumAbs(DefaultScale, src); Assert.Equal(expected, actual, 2); }
/// <summary> /// Compute L1-norm. L1-norm computation doesn't subtract the mean from the source values. /// However, we substract the mean here in case subMean is true (if subMean is false, mean is zero). /// </summary> private static Float L1Norm(Float[] values, int count, Float mean = 0) { if (count == 0) { return(0); } return(CpuMathUtils.SumAbs(mean, values, 0, count)); }
public void SumAbsDiffUTest(int test, float defaultScale) { float[] src = (float[])_testArrays[test].Clone(); var actual = CpuMathUtils.SumAbs(defaultScale, src); float expected = 0; for (int i = 0; i < src.Length; i++) { expected += Math.Abs(src[i] - defaultScale); } Assert.Equal(expected, actual, 2); }
public void SumAbsUTest(string mode, string test, Dictionary <string, string> environmentVariables) { RemoteExecutor.RemoteInvoke((arg0, arg1) => { CheckProperFlag(arg0); float[] src = (float[])_testArrays[int.Parse(arg1)].Clone(); float expected = 0; for (int i = 0; i < src.Length; i++) { expected += Math.Abs(src[i]); } var actual = CpuMathUtils.SumAbs(src); Assert.Equal(expected, actual, 2); return(RemoteExecutor.SuccessExitCode); }, mode, test, new RemoteInvokeOptions(environmentVariables)); }
public float SumAbsDiffU() => CpuMathUtils.SumAbs(DefaultScale, src.AsSpan(0, _smallInputLength));
public float SumAbsU() => CpuMathUtils.SumAbs(src.AsSpan(0, _smallInputLength));
public float ManagedSumAbsqUPerf() => CpuMathUtils.SumAbs(src, LEN);
public float ManagedSumAbsDiffUPerf() => CpuMathUtils.SumAbs(DEFAULT_SCALE, src, 0, LEN);