Class TensorMapper<T extends TType>

java.lang.Object
org.tensorflow.TensorMapper<T>
Type Parameters:
T - tensor type mapped by this object

public abstract class TensorMapper<T extends TType> extends Object
Maps the native memory of a RawTensor to a n-dimensional typed data space accessible from the JVM.

Usage of this class is reserved for internal purposes only.

See Also:
  • Constructor Details

    • TensorMapper

      public TensorMapper()
  • Method Details

    • mapDense

      protected abstract T mapDense(RawTensor tensor)
      Maps the provided dense raw tensor as a tensor of type T.
      Parameters:
      tensor - the dense tensor to map, in its raw nature
      Returns:
      an instance of T
    • mapSparse

      protected abstract SparseTensor<T> mapSparse(TInt64 indices, T values, TInt64 denseShape, PointerScope tensorScope)
      Maps the provided dense tensors as a sparse tensor of type T.
      Parameters:
      indices - indices of the non-default values in a dense space
      values - non-default values of the tensor
      denseShape - size of the dimensions definining the shape of the sparse tensor in a dense space.
      tensorScope - scope to extend to keep a reference on the sub-tensors composing this sparse tensor
      Returns:
      an instance of T.
    • nativeHandle

      protected static TF_Tensor nativeHandle(RawTensor tensor)
      Helper for retrieving the native handle of a raw tensor
      Parameters:
      tensor - a raw tensor
      Returns:
      the native handle of that tensor
      Throws:
      IllegalStateException - if the tensor has been released