TensorBuffers

public final class TensorBuffers

Maps native tensor memory into DataBuffers, allowing I/O operations from the JVM.

Public Constructors

Public Methods

static BooleanDataBuffer
toBooleans(TF_Tensor nativeTensor)
Maps tensor memory as a buffer of booleans.
static ByteDataBuffer
toBytes(TF_Tensor nativeTensor)
Maps tensor memory as a buffer of bytes.
static ByteDataBuffer
toBytes(TF_Tensor nativeTensor, boolean readOnly)
Maps tensor memory as a buffer of bytes.
static DoubleDataBuffer
toDoubles(TF_Tensor nativeTensor)
Maps tensor memory as a buffer of doubles.
static FloatDataBuffer
toFloats(TF_Tensor nativeTensor)
Maps tensor memory as a buffer of floats.
static IntDataBuffer
toInts(TF_Tensor nativeTensor)
Maps tensor memory as a buffer of integers.
static LongDataBuffer
toLongs(TF_Tensor nativeTensor)
Maps tensor memory as a buffer of longs.
static ShortDataBuffer
toShorts(TF_Tensor nativeTensor)
Maps tensor memory as a buffer of shorts.
static ByteSequenceTensorBuffer
toStrings(TF_Tensor nativeTensor, long numElements)
Maps tensor memory as a buffer of byte sequences, often used to store string values.

Inherited Methods

boolean
equals(Object arg0)
final Class<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()

Public Constructors

public TensorBuffers ()

Public Methods

public static BooleanDataBuffer toBooleans (TF_Tensor nativeTensor)

Maps tensor memory as a buffer of booleans.

Parameters
nativeTensor native reference to the tensor
Returns
  • a boolean buffer

public static ByteDataBuffer toBytes (TF_Tensor nativeTensor)

Maps tensor memory as a buffer of bytes.

Parameters
nativeTensor native reference to the tensor
Returns
  • a byte buffer

public static ByteDataBuffer toBytes (TF_Tensor nativeTensor, boolean readOnly)

Maps tensor memory as a buffer of bytes.

Parameters
nativeTensor native reference to the tensor
readOnly true to return a read-only buffer
Returns
  • a byte buffer

public static DoubleDataBuffer toDoubles (TF_Tensor nativeTensor)

Maps tensor memory as a buffer of doubles.

Parameters
nativeTensor native reference to the tensor
Returns
  • a double buffer

public static FloatDataBuffer toFloats (TF_Tensor nativeTensor)

Maps tensor memory as a buffer of floats.

Parameters
nativeTensor native reference to the tensor
Returns
  • a float buffer

public static IntDataBuffer toInts (TF_Tensor nativeTensor)

Maps tensor memory as a buffer of integers.

Parameters
nativeTensor native reference to the tensor
Returns
  • an int buffer

public static LongDataBuffer toLongs (TF_Tensor nativeTensor)

Maps tensor memory as a buffer of longs.

Parameters
nativeTensor native reference to the tensor
Returns
  • a long buffer

public static ShortDataBuffer toShorts (TF_Tensor nativeTensor)

Maps tensor memory as a buffer of shorts.

Parameters
nativeTensor native reference to the tensor
Returns
  • a short buffer

public static ByteSequenceTensorBuffer toStrings (TF_Tensor nativeTensor, long numElements)

Maps tensor memory as a buffer of byte sequences, often used to store string values.

Parameters
nativeTensor native reference to the tensor
Returns
  • a string buffer