public void MaxAbsDiffUTest(int test, float expected) { float[] src = (float[])_testArrays[test].Clone(); var actual = CpuMathUtils.MaxAbsDiff(DefaultScale, src); Assert.Equal(expected, actual, 2); }
public void MaxAbsDiffUTest(int test, float expected) { float[] src = (float[])testArrays[test].Clone(); var actual = CpuMathUtils.MaxAbsDiff(DEFAULT_SCALE, src, src.Length); Assert.Equal(expected, actual, 2); }
/// <summary> /// Compute LInf-norm. LInf-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 LInfNorm(Float[] values, int count, Float mean = 0) { if (count == 0) { return(0); } return(CpuMathUtils.MaxAbsDiff(mean, values, count)); }
public void MaxAbsDiffUTest(int test, float defaultScale) { float[] src = (float[])_testArrays[test].Clone(); var actual = CpuMathUtils.MaxAbsDiff(defaultScale, src); float expected = 0; for (int i = 0; i < src.Length; i++) { float abs = Math.Abs(src[i] - defaultScale); if (abs > expected) { expected = abs; } } Assert.Equal(expected, actual, 2); }
public void MaxAbsDiffUTest(string mode, string test, string scale, Dictionary <string, string> environmentVariables) { RemoteExecutor.RemoteInvoke((arg0, arg1, arg2) => { CheckProperFlag(arg0); float defaultScale = float.Parse(arg2, CultureInfo.InvariantCulture); float[] src = (float[])_testArrays[int.Parse(arg1)].Clone(); var actual = CpuMathUtils.MaxAbsDiff(defaultScale, src); float expected = 0; for (int i = 0; i < src.Length; i++) { float abs = Math.Abs(src[i] - defaultScale); if (abs > expected) { expected = abs; } } Assert.Equal(expected, actual, 2); return(RemoteExecutor.SuccessExitCode); }, mode, test, scale, new RemoteInvokeOptions(environmentVariables)); }
public float MaxAbsDiffU() => CpuMathUtils.MaxAbsDiff(DefaultScale, src.AsSpan(0, _smallInputLength));
public float ManagedMaxAbsDiffUPerf() => CpuMathUtils.MaxAbsDiff(DEFAULT_SCALE, src, LEN);