forked from emmaggie/nd4j
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add input validation for row/column vector ops
- Loading branch information
1 parent
42df7f6
commit 1f9190b
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
nd4j-backends/nd4j-tests/src/test/java/org/nd4j/linalg/InputValidationTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.nd4j.linalg; | ||
|
||
import org.junit.Test; | ||
import org.nd4j.linalg.api.ndarray.INDArray; | ||
import org.nd4j.linalg.factory.Nd4j; | ||
|
||
/** | ||
* Created by Alex on 05/08/2016. | ||
*/ | ||
public class InputValidationTests { | ||
|
||
@Test(expected=IllegalStateException.class) | ||
public void testInvalidColVectorOp1(){ | ||
INDArray first = Nd4j.create(10,10); | ||
INDArray col = Nd4j.create(5,1); | ||
first.muliColumnVector(col); | ||
} | ||
|
||
@Test(expected=IllegalStateException.class) | ||
public void testInvalidColVectorOp2(){ | ||
INDArray first = Nd4j.create(10,10); | ||
INDArray col = Nd4j.create(5,1); | ||
first.addColumnVector(col); | ||
} | ||
|
||
@Test(expected=IllegalStateException.class) | ||
public void testInvalidRowVectorOp1(){ | ||
INDArray first = Nd4j.create(10,10); | ||
INDArray row = Nd4j.create(1,5); | ||
first.addiRowVector(row); | ||
} | ||
|
||
@Test(expected=IllegalStateException.class) | ||
public void testInvalidRowVectorOp2(){ | ||
INDArray first = Nd4j.create(10,10); | ||
INDArray row = Nd4j.create(1,5); | ||
first.subRowVector(row); | ||
} | ||
|
||
} |