コード例 #1
0
        public void MaxAbsDiffUTest(int test, float expected)
        {
            float[] src    = (float[])_testArrays[test].Clone();
            var     actual = CpuMathUtils.MaxAbsDiff(DefaultScale, src);

            Assert.Equal(expected, actual, 2);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 /// <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));
 }
コード例 #4
0
        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);
        }
コード例 #5
0
        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));
        }
コード例 #6
0
 public float MaxAbsDiffU()
 => CpuMathUtils.MaxAbsDiff(DefaultScale, src.AsSpan(0, _smallInputLength));
コード例 #7
0
 public float ManagedMaxAbsDiffUPerf() => CpuMathUtils.MaxAbsDiff(DEFAULT_SCALE, src, LEN);