public void Replicate_NegativeRepeats_ThrowException() { // arrange var input = NdArray <int> .Arange(HostDevice.Instance, 0, 2 * 3, 1).Reshape(new[] { 2, 3 }); // action var result = NdArrayOperator <int> .Replicate(0, -10, input); }
public void Concat_AxisOutOfrangeCase1_ThrowException() { // arrange const int ConcatAxis = 3; var inputs = new NdArray <int>[] { NdArray <int> .Zeros(HostDevice.Instance, new[] { 1, 1 }) }; // action NdArrayOperator <int> .Concat(ConcatAxis, inputs); }
public void Concat_EmptyInput_ThrowException() { // arrange const int DummyAxis = 1; var emptyInputs = new NdArray <int>[] { }; // action NdArrayOperator <int> .Concat(DummyAxis, emptyInputs); }
public void Diag_OneDimensionalArray_ThrowException() { // arrange var device = HostDevice.Instance; var input = NdArray <int> .Arange(device, 0, 9, 1); // action var diag = NdArrayOperator <int> .Diag(input); }
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 DiagMatAxis_InvalidAxis() { // arrange var axis1 = 1; var axis2 = 3; var input = NdArray <int> .Arange(HostDevice.Instance, 0, 10, 1).Reshape(new[] { 2, 5 }); // action var diagMat = NdArrayOperator <int> .DiagMatAxis(axis1, axis2, input); }
public void Replicate() { // arrange var input = NdArray <int> .Arange(HostDevice.Instance, 0, 2 * 3, 1).Reshape(new[] { 2, 3 }); // action var result = NdArrayOperator <int> .Replicate(0, 10, input); // assert CollectionAssert.AreEqual(new[] { 20, 3 }, result.Shape); }
public void Diff() { // arrange var input = NdArray <int> .Arange(HostDevice.Instance, 0, 9, 1).Reshape(new[] { 3, 3 }); // action var result = NdArrayOperator <int> .Diff(input); // assert CollectionAssert.AreEqual(new[] { 3, 2 }, result.Shape); }
public void DiagMat() { // arrange var input = NdArray <int> .Arange(HostDevice.Instance, 0, 3, 1); // action var diagMat = NdArrayOperator <int> .DiagMat(input); // assert CollectionAssert.AreEqual(new[] { 3, 3 }, diagMat.Shape); }
public void DiagAxis() { // arrange var device = HostDevice.Instance; var input = NdArray <int> .Zeros(device, new[] { 4, 3, 3, 5 }); // action var diag = NdArrayOperator <int> .DiagAxis(1, 2, input); // assert CollectionAssert.AreEqual(new[] { 4, 3, 5 }, diag.Shape); }
public void Copy_ColumnMajor() { // arrange var input = NdArray <int> .Arange(HostDevice.Instance, 0, 10, 1).Reshape(new[] { 2, 5 }); // action var copy = NdArrayOperator <int> .Copy(input, Order.ColumnMajor); // assert CollectionAssert.AreEqual(new[] { 2, 5 }, copy.Shape); CollectionAssert.AreEqual(new[] { 1, 2 }, copy.Layout.Stride); }
public void DiagMatAxis() { // arrange var axis1 = 0; var axis2 = 1; var input = NdArray <int> .Arange(HostDevice.Instance, 0, 12, 1).Reshape(new[] { 4, 3 }); // action var diagMat = NdArrayOperator <int> .DiagMatAxis(axis1, axis2, input); // assert CollectionAssert.AreEqual(new[] { 4, 4, 3 }, diagMat.Shape); }
public void Concat_DifferntShapes_ThrowException() { // arrange const int ConcatAxis = 1; var inputs = new NdArray <int>[] { NdArray <int> .Zeros(HostDevice.Instance, new[] { 1, 1 }), NdArray <int> .Zeros(HostDevice.Instance, new[] { 2, 1 }) }; // action NdArrayOperator <int> .Concat(ConcatAxis, inputs); }
public void Diag() { // arrange var device = HostDevice.Instance; var input = NdArray <int> .Arange(device, 0, 9, 1).Reshape(new[] { 3, 3 }); // action var diag = NdArrayOperator <int> .Diag(input); // assert Assert.AreEqual(0, diag[0].Value); Assert.AreEqual(4, diag[1].Value); Assert.AreEqual(8, diag[2].Value); }
public void Transpos() { // arrange var input = NdArray <int> .Arange(HostDevice.Instance, 0, 4, 1).Reshape(new[] { 2, 2 }); // action var result = NdArrayOperator <int> .Transpos(input); // assert Assert.AreEqual(0, result[new[] { 0, 0 }]); Assert.AreEqual(1, result[new[] { 1, 0 }]); Assert.AreEqual(2, result[new[] { 0, 1 }]); Assert.AreEqual(3, result[new[] { 1, 1 }]); }
public void Concat() { // arrange const int ConcatAxis = 1; var inputs = new NdArray <int>[] { NdArray <int> .Zeros(HostDevice.Instance, new[] { 4, 28 }), NdArray <int> .Zeros(HostDevice.Instance, new[] { 4, 15 }), NdArray <int> .Zeros(HostDevice.Instance, new[] { 4, 10 }) }; // action var concat = NdArrayOperator <int> .Concat(ConcatAxis, inputs); // assert CollectionAssert.AreEqual(new[] { 4, 53 }, concat.Shape); }