public static int mapIndexOntoTensor ( int index , INDArray arr , int ... rank ) { int ret = index * ArrayUtil . prod ( ArrayUtil . removeIndex ( arr . shape ( ) , rank ) ) ; return ret ; }
This maps an index of a vector on to a vector in the matrix that can be used for indexing in to a tensor