docs: public static DenseTensor copyOf(Tensor tensor) {
      if (tensor instanceof DenseTensor) {
        // Tensors are immutable, so there's no reason to copy the input.
        return (DenseTensor) tensor;
      } else {
        DenseTensorBuilder builder = new DenseTensorBuilder(tensor.getDimensionNumbers(),
            tensor.getDimensionSizes());
        double[] otherValues = tensor.getValues();
        for (int i = 0; i < otherValues.length; i++) {
          builder.putByKeyNum(tensor.indexToKeyNum(i), otherValues[i]);
        }
        return builder.buildNoCopy();
      }
    }