code: public static long numVectors(INDArray arr) {
          if (arr.rank() == 1)
              return 1;
          else if (arr.rank() == 2)
              return arr.size(0);
          else {
              int prod = 1;
              for (int i = 0; i < arr.rank() - 1; i++) {
                  prod *= arr.size(i);
              }
  
              return prod;
          }
      }
docs: Return the number of vectors for an array
  the number of vectors for an array
  @param arr the array to calculate the number of vectors for
  @return the number of vectors for the given array