Nd4j refactoring (#112)

* refactoring

Signed-off-by: Robert Altena <Rob@Ra-ai.com>

* wip

Signed-off-by: Robert Altena <Rob@Ra-ai.com>

* wip

Signed-off-by: Robert Altena <Rob@Ra-ai.com>

* wip

* fix: make test public.

Signed-off-by: Robert Altena <Rob@Ra-ai.com>

* make test public.

Signed-off-by: Robert Altena <Rob@Ra-ai.com>

* fixes read refactoring.

Signed-off-by: Robert Altena <Rob@Ra-ai.com>
master
Robert Altena 2019-08-15 13:50:52 +09:00 committed by GitHub
parent c7277729e9
commit 59cba587f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 169 additions and 360 deletions

View File

@ -7979,6 +7979,14 @@ public class Nd4jTestsC extends BaseNd4jTest {
//from [4,4,3] to [2,4,6] then crop to [2,4,5] //from [4,4,3] to [2,4,6] then crop to [2,4,5]
} }
@Test
public void testToFromByteArray() throws IOException {
// simple test to get rid of toByteArray and fromByteArray compiler warnings.
INDArray x = Nd4j.arange(10);
byte[] xb = Nd4j.toByteArray(x);
INDArray y = Nd4j.fromByteArray(xb);
assertEquals(x,y);
}
private static INDArray fwd(INDArray input, INDArray W, INDArray b){ private static INDArray fwd(INDArray input, INDArray W, INDArray b){
INDArray ret = Nd4j.createUninitialized(input.size(0), W.size(1)); INDArray ret = Nd4j.createUninitialized(input.size(0), W.size(1));

View File

@ -102,7 +102,7 @@ public class RngTests extends BaseNd4jTest {
} }
@Test @Test
void testRandomBinomial() { public void testRandomBinomial() {
//silly tests. Just increasing the usage for randomBinomial to stop compiler warnings. //silly tests. Just increasing the usage for randomBinomial to stop compiler warnings.
INDArray x = Nd4j.randomBinomial(10, 0.5, 3,3); INDArray x = Nd4j.randomBinomial(10, 0.5, 3,3);
assertTrue(x.sum().getDouble(0) > 0.0); //silly test. Just increasing th usage for randomBinomial assertTrue(x.sum().getDouble(0) > 0.0); //silly test. Just increasing th usage for randomBinomial