code: public static INDArrayIndex[] allFor(INDArray arr) {
          INDArrayIndex[] ret = new INDArrayIndex[arr.rank()];
          for (int i = 0; i < ret.length; i++)
              ret[i] = NDArrayIndex.all();
  
          return ret;
      }
docs: Generate an all index
  equal to the rank of the given array
  @param arr the array to generate the all index for
  @return an ndarray index array containing of length
  arr.rank() containing all elements