in source/neuropod/bindings/java/src/main/java/com/uber/neuropod/NeuropodTensor.java [277:298]
private long toPos(long[] index) {
long[] dims = getDims();
if (index.length != dims.length) {
throw new java.lang.IndexOutOfBoundsException("index "
+ Arrays.toString(index) + " does not match dimension size, actual dims is " + Arrays.toString(dims));
}
long pos = 0;
long acc = 1;
for (int i = dims.length - 1; i >= 0; i--) {
if (index[i] >= dims[i]) {
throw new java.lang.IndexOutOfBoundsException("index "
+ Arrays.toString(index) + " has out of bounds value, actual dims is " + Arrays.toString(dims));
}
pos += index[i] * acc;
if (i != 0) {
acc *= dims[i];
}
}
return pos;
}