I want to use below code to get rows for further used, when the size is bigger then 1, the program work fine and return value [8]. but it return the whole INDArray [1, 8] when the size is 1. Then I can't concat it with others.
for (int j = 0; j < size; j++) {
tmp = outArray.getRow(j);
// to do sth
}
Reproducer:
INDArray ones = Nd4j.ones(1, 8);
System.out.println(ones.shapeInfoToString());
ones = ones.getRow(0);
System.out.println(ones.shapeInfoToString());
ones = Nd4j.ones(2, 8);
System.out.println(ones.shapeInfoToString());
ones = ones.getRow(0);
System.out.println(ones.shapeInfoToString());
I want to use below code to get rows for further used, when the size is bigger then 1, the program work fine and return value [8]. but it return the whole INDArray [1, 8] when the size is 1. Then I can't concat it with others.
for (int j = 0; j < size; j++) {
tmp = outArray.getRow(j);
// to do sth
}
Reproducer:
INDArray ones = Nd4j.ones(1, 8);
System.out.println(ones.shapeInfoToString());
ones = ones.getRow(0);
System.out.println(ones.shapeInfoToString());
ones = Nd4j.ones(2, 8);
System.out.println(ones.shapeInfoToString());
ones = ones.getRow(0);
System.out.println(ones.shapeInfoToString());