Java Code Examples for org.nd4j.linalg.api.shape.Shape#toOffsetZero()

The following examples show how to use org.nd4j.linalg.api.shape.Shape#toOffsetZero() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShapeTestC.java    From nd4j with Apache License 2.0 6 votes vote down vote up
@Test
public void testToOffsetZero() {
    INDArray matrix = Nd4j.rand(3, 5);
    INDArray rowOne = matrix.getRow(1);
    INDArray row1Copy = Shape.toOffsetZero(rowOne);
    assertEquals(rowOne, row1Copy);
    INDArray rows = matrix.getRows(1, 2);
    INDArray rowsOffsetZero = Shape.toOffsetZero(rows);
    assertEquals(rows, rowsOffsetZero);

    INDArray tensor = Nd4j.rand(new int[] {3, 3, 3});
    INDArray getTensor = tensor.slice(1).slice(1);
    INDArray getTensorZero = Shape.toOffsetZero(getTensor);
    assertEquals(getTensor, getTensorZero);


}
 
Example 2
Source File: ShapeTest.java    From nd4j with Apache License 2.0 6 votes vote down vote up
@Test
public void testToOffsetZero() {
    INDArray matrix = Nd4j.rand(3, 5);
    INDArray rowOne = matrix.getRow(1);
    INDArray row1Copy = Shape.toOffsetZero(rowOne);
    assertEquals(rowOne, row1Copy);
    INDArray rows = matrix.getRows(1, 2);
    INDArray rowsOffsetZero = Shape.toOffsetZero(rows);
    assertEquals(rows, rowsOffsetZero);

    INDArray tensor = Nd4j.rand(new int[] {3, 3, 3});
    INDArray getTensor = tensor.slice(1).slice(1);
    INDArray getTensorZero = Shape.toOffsetZero(getTensor);
    assertEquals(getTensor, getTensorZero);



}
 
Example 3
Source File: ShapeTestC.java    From deeplearning4j with Apache License 2.0 6 votes vote down vote up
@Test
public void testToOffsetZero() {
    INDArray matrix = Nd4j.rand(3, 5);
    INDArray rowOne = matrix.getRow(1);
    INDArray row1Copy = Shape.toOffsetZero(rowOne);
    assertEquals(rowOne, row1Copy);
    INDArray rows = matrix.getRows(1, 2);
    INDArray rowsOffsetZero = Shape.toOffsetZero(rows);
    assertEquals(rows, rowsOffsetZero);

    INDArray tensor = Nd4j.rand(new int[] {3, 3, 3});
    INDArray getTensor = tensor.slice(1).slice(1);
    INDArray getTensorZero = Shape.toOffsetZero(getTensor);
    assertEquals(getTensor, getTensorZero);


}
 
Example 4
Source File: ShapeTest.java    From deeplearning4j with Apache License 2.0 6 votes vote down vote up
@Test
public void testToOffsetZero() {
    INDArray matrix = Nd4j.rand(3, 5);
    INDArray rowOne = matrix.getRow(1);
    INDArray row1Copy = Shape.toOffsetZero(rowOne);
    assertEquals(rowOne, row1Copy);
    INDArray rows = matrix.getRows(1, 2);
    INDArray rowsOffsetZero = Shape.toOffsetZero(rows);
    assertEquals(rows, rowsOffsetZero);

    INDArray tensor = Nd4j.rand(new int[] {3, 3, 3});
    INDArray getTensor = tensor.slice(1).slice(1);
    INDArray getTensorZero = Shape.toOffsetZero(getTensor);
    assertEquals(getTensor, getTensorZero);



}