code: public static Tensor toTensor(INDArray arr) {
          FlatBufferBuilder bufferBuilder = new FlatBufferBuilder(1024);
          long[] strides = getArrowStrides(arr);
          int shapeOffset = createDims(bufferBuilder,arr);
          int stridesOffset = Tensor.createStridesVector(bufferBuilder,strides);
  
          Tensor.startTensor(bufferBuilder);
  
          addTypeTypeRelativeToNDArray(bufferBuilder,arr);
          Tensor.addShape(bufferBuilder,shapeOffset);
          Tensor.addStrides(bufferBuilder,stridesOffset);
  
          Tensor.addData(bufferBuilder,addDataForArr(bufferBuilder,arr));
          int endTensor = Tensor.endTensor(bufferBuilder);
          Tensor.finishTensorBuffer(bufferBuilder,endTensor);
          return Tensor.getRootAsTensor(bufferBuilder.dataBuffer());
      }
docs: Convert an {@link INDArray}
  to an arrow {@link Tensor}
  @param arr the array to convert
  @return the equivalent {@link Tensor}