nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/NDArrayIndex.java
public static INDArrayIndex[] create(INDArray index) {

        if (index.isMatrix()) {

            if (index.rows() > Integer.MAX_VALUE)
                throw new ND4JArraySizeException();

            NDArrayIndex[] ret = new NDArrayIndex[(int) index.rows()];
            for (int i = 0; i < index.rows(); i++) {
                INDArray row = index.getRow(i);
                val nums = new long[(int) index.getRow(i).columns()];
                for (int j = 0; j < row.columns(); j++) {
                    nums[j] = (int) row.getFloat(j);
                }

                NDArrayIndex idx = new NDArrayIndex(nums);
                ret[i] = idx;

            }


            return ret;

        } else if (index.isVector()) {
            long[] indices = NDArrayUtil.toLongs(index);
            return new NDArrayIndex[] {new NDArrayIndex(indices)};
        }


        throw new IllegalArgumentException("Passed in ndarray must be a matrix or a vector");

    }
public static INDArrayIndex[] create(INDArray index) {

        if (index.isMatrix()) {

            if (index.rows() > Integer.MAX_VALUE)
                throw new ND4JArraySizeException();

            NDArrayIndex[] ret = new NDArrayIndex[(int) index.rows()];
            for (int i = 0; i < index.rows(); i++) {
                INDArray row = index.getRow(i);
                val nums = new long[(int) index.getRow(i).columns()];
                for (int j = 0; j < row.columns(); j++) {
                    nums[j] = (int) row.getFloat(j);
                }

                NDArrayIndex idx = new NDArrayIndex(nums);
                ret[i] = idx;

            }


            return ret;

        } else if (index.isVector()) {
            long[] indices = NDArrayUtil.toLongs(index);
            return new NDArrayIndex[] {new NDArrayIndex(indices)};
        }


        throw new IllegalArgumentException("Passed in ndarray must be a matrix or a vector");

    }
Create from a matrix. The rows are the indices
The columns are the individual element in each ndarrayindex

@param index the matrix to getFloat indices from
@return the indices to getFloat