numsca icon indicating copy to clipboard operation
numsca copied to clipboard

Array index out of bounds error despite seemingly valid value

Open JKOK005 opened this issue 5 years ago • 1 comments

Hi, I ran into this error when calling ns.ones(2,1)(0)

Error msg: java.lang.ArrayIndexOutOfBoundsException: 1 at org.nd4j.linalg.indexing.ShapeOffsetResolution.tryShortCircuit(ShapeOffsetResolution.java:82) at org.nd4j.linalg.indexing.ShapeOffsetResolution.exec(ShapeOffsetResolution.java:329) at org.nd4j.linalg.api.ndarray.BaseNDArray.get(BaseNDArray.java:4175) at botkop.numsca.Tensor.apply(Tensor.scala:120) at botkop.numsca.Tensor.apply(Tensor.scala:126) ... 28 elided

The expected output should be Tensor(1) since I'm taking the first slice row-wise.

Is this a limitation of the Tensor library, in that we are unable to work with shapes (x,1) ?

JKOK005 avatar Nov 25 '20 16:11 JKOK005

sorry for the extremely late response yes, that seems to a limitation imposed by nd4j perhaps this could be intercepted by numsca

koen-dejonghe avatar Mar 15 '21 13:03 koen-dejonghe