public void Convert_InvalidConvert_ThrowException() { // arrange var source = NdArray <int> .Scalar(HostDevice.Instance, 2); // action var result = DataFunction <string> .Convert(source); }
public void Diff_Scalar_ThrowException() { // arrange const int DummyValue = 3; var input = NdArray <int> .Scalar(HostDevice.Instance, DummyValue); // action var diagMat = NdArrayOperator <int> .Diff(input); }
public void AtLeast2d() { // arrange const int DummyValue = 1; var input = NdArray <int> .Scalar(HostDevice.Instance, DummyValue); // action var output = ShapeFunction <int> .AtLeast2d(input); // assert CollectionAssert.AreEqual(new[] { 1, 1 }, output.Shape); }
public void Convert() { // arrange var source = NdArray <int> .Scalar(HostDevice.Instance, 2); // action var result = DataFunction <double> .Convert(source).Value; // assert Assert.IsInstanceOfType(result, typeof(double)); Assert.AreEqual(2.0, result); }
public void Add_ScalarWithVector() { // arrange var device = HostDevice.Instance; var inputA = NdArray <int> .Arange(device, 0, 10, 1); var inputB = NdArray <int> .Scalar(device, 3); // action var equal = inputB + inputA; // assert CollectionAssert.AreEqual(new[] { 10 }, equal.Shape); }
public void Modulo_VectorWithScalar() { // arrange var device = HostDevice.Instance; var inputA = NdArray <int> .Arange(device, 1, 11, 1); var inputB = NdArray <int> .Scalar(device, 3); // action var equal = inputA % inputB; // assert CollectionAssert.AreEqual(new[] { 10 }, equal.Shape); }