docs: @Override
      public INDArray concat(int dimension, INDArray... toConcat) {
          if (toConcat == null || toConcat.length == 0)
              throw new ND4JIllegalStateException("Can't concatenate 0 arrays");
  
          if (toConcat.length == 1)
              return toConcat[0];
  
          // if reusable var wasn't created for this thread, or is smaller then needed - set it to new value
          if (extrazA.get() == null || extrazB.get() == null || extrazSize.get() == null || extrazSize.get() < toConcat.length) {
              extrazA.set(new PointerPointer(toConcat.length));
              extrazB.set(new PointerPointer(toConcat.length));
              extrazSize.set(toConcat.length);
          }
  
          PointerPointer shapeInfoPointers = extrazA.get();
          PointerPointer dataPointers = extrazB.get();
          int sumAlongDim = 0;
  
          long[] outputShape = ArrayUtil.copy(toConcat[0].shape());
  
          boolean allScalars = true;
  
          for (int i = 0; i < toConcat.length; i++) {
              Preconditions.checkState(toConcat[i].rank() == outputShape.length, "Encountered different array ranks for concat: input[0].shape()=%ndShape, input[%s].shape()=%ndShape",
                      toConcat[0], i, toConcat[i]);
  
              if (toConcat[i].isCompressed())
                  Nd4j.getCompressor().decompressi(toConcat[i]);
  
              Preconditions.checkArgument(toConcat[i].dataType() == toConcat[0].dataType(), "All operands must have same data type: input 0 has type %s, input %s has type %s",
                      toConcat[0].dataType(), i, toConcat[i].dataType());
  
              allScalars &= toConcat[i].rank() == 0;
  
              shapeInfoPointers.put(i, toConcat[i].shapeInfoDataBuffer().addressPointer());
              dataPointers.put(i, toConcat[i].data().addressPointer());
              sumAlongDim += toConcat[i].size(dimension);
              for (int j = 0; j < toConcat[i].rank(); j++) {
  
                  if (j != dimension && toConcat[i].size(j) != outputShape[j]) {
                      throw new IllegalArgumentException(
                              "Illegal concatenation at array " + i + " and shape element " + j);
                  }
              }
  
  
              //log.info("Shape[{}]: {}", i, Arrays.toString(toConcat[i].shapeInfoDataBuffer().asInt()));
          }
  
          if (allScalars) {
              outputShape = new long[]{sumAlongDim};
          } else {
              outputShape[dimension] = sumAlongDim;
          }
  
          //PointerPointer dummy = new PointerPointer(new Pointer[] {null});
  
          INDArray ret = Nd4j.createUninitialized(toConcat[0].dataType(), outputShape, Nd4j.order()).assign(-123);
  
          nativeOps.concat(null, dimension, toConcat.length,
                      dataPointers, shapeInfoPointers,
                  null, null,
                      ret.data().addressPointer(), (LongPointer) ret.shapeInfoDataBuffer().addressPointer(),
                      null, null,
                      //new PointerPointer(new Pointer[] {null}), new PointerPointer(new Pointer[] {null}));
                      null, null);
  
          return ret;
          // return super.concat(dimension,toConcat);
      }