public void VarAxis() { // arrange var device = HostDevice.Instance; var input = NdArray <double> .Arange(device, 1, 9, 1).Reshape(new[] { 2, 4 }); // action var var = ReductionFunction <double> .VarAxis(1, input); // assert Assert.AreEqual(1.25, var[0].Value); }
public void VarAxis_Ddof1() { // arrange var device = HostDevice.Instance; var input = NdArray <double> .Arange(device, 1, 9, 1).Reshape(new[] { 2, 4 }); // action var var = ReductionFunction <double> .VarAxis(1, input, 1.0); // assert const double Epsilon = 1e-8; Assert.IsTrue(Math.Abs(1.666666666 - var[0].Value) < Epsilon); }