Search in sources :

Example 1 with BroadcastOp

use of org.nd4j.linalg.api.ops.BroadcastOp in project nd4j by deeplearning4j.

the class Nd4jTestsC method testBroadcastRepeated.

@Test
public void testBroadcastRepeated() {
    INDArray z = Nd4j.create(1, 4, 4, 3);
    INDArray bias = Nd4j.create(1, 3);
    BroadcastOp op = new BroadcastAddOp(z, bias, z, 3);
    Nd4j.getExecutioner().exec(op);
    System.out.println("First: OK");
    // OK at this point: executes successfully
    z = Nd4j.create(1, 4, 4, 3);
    bias = Nd4j.create(1, 3);
    op = new BroadcastAddOp(z, bias, z, 3);
    // Crashing here, when we are doing exactly the same thing as before...
    Nd4j.getExecutioner().exec(op);
    System.out.println("Second: OK");
}
Also used : INDArray(org.nd4j.linalg.api.ndarray.INDArray) BroadcastOp(org.nd4j.linalg.api.ops.BroadcastOp) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 INDArray (org.nd4j.linalg.api.ndarray.INDArray)1 BroadcastOp (org.nd4j.linalg.api.ops.BroadcastOp)1