示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#4
0
 /// <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));
 }
示例#5
0
        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);
        }
示例#6
0
        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));
        }
示例#7
0
 public float SumAbsDiffU()
 => CpuMathUtils.SumAbs(DefaultScale, src.AsSpan(0, _smallInputLength));
示例#8
0
 public float SumAbsU()
 => CpuMathUtils.SumAbs(src.AsSpan(0, _smallInputLength));
 public float ManagedSumAbsqUPerf() => CpuMathUtils.SumAbs(src, LEN);
示例#10
0
 public float ManagedSumAbsDiffUPerf() => CpuMathUtils.SumAbs(DEFAULT_SCALE, src, 0, LEN);