public static long sliceOffsetForTensor ( int index , INDArray arr , int [ ] tensorShape ) { long tensorLength = ArrayUtil . prodLong ( tensorShape ) ; long lengthPerSlice = NDArrayMath . lengthPerSlice ( arr ) ; long offset = index * tensorLength / lengthPerSlice ; return offset ; }
calculates the offset for a tensor