A tensor which memory has not been mapped to a data space directly accessible from the JVM.
A raw tensor is a minimalist representation of a tensor allocated in native memory by the
TensorFlow runtime library and it controls its lifetime within the current process. The data
is represented by a flat buffer of bytes
, until it is mapped in a
n-dimensional typed space by a typed tensor
.
Instances of a RawTensor are not thread-safe and their resource must be released
by calling close()
explicitly or implicitly via try-with-resources.
Public Methods
RawTensor |
asRawTensor()
Returns a raw (untyped) representation of this tensor
|
void |
close()
Release resources associated with the Tensor.
|
ByteDataBuffer |
data()
Returns the raw data of this tensor as a buffer of bytes.
|
DataType | |
long |
numBytes()
Returns the size, in bytes, of the tensor data.
|
Shape |
shape()
Returns the shape of the tensor.
|
String |
toString()
Returns a string describing the type and shape of the tensor.
|
Inherited Methods
Public Methods
public void close ()
Release resources associated with the Tensor.
WARNING:This must be invoked for all tensors that were not been produced by an eager operation or memory will be leaked.
The Tensor object is no longer usable after close
returns.
public ByteDataBuffer data ()
Returns the raw data of this tensor as a buffer of bytes.
Returns
- the tensor bytes
Throws
IllegalStateException | if the tensor has been closed |
---|
public long numBytes ()
Returns the size, in bytes, of the tensor data.
public String toString ()
Returns a string describing the type and shape of the tensor.