Skip to content

The behavior is not the same in INDArray.getRow() #9709

Description

@SidneyLann

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());

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions