A typed multidimensional array used in Tensorflow Lite.
The native handle of a
Tensor
is managed by
NativeInterpreterWrapper
, and does
not needed to be closed by the client. However, once the
NativeInterpreterWrapper
has
been closed, the tensor handle will be invalidated.
Nested Classes
class  Tensor.QuantizationParams 
Quantization parameters that corresponds to the table,
QuantizationParameters
, in the
TFLite
Model schema file.

Public Methods
DataType  
int 
numBytes
()
Returns the size, in bytes, of the tensor data.

int 
numDimensions
()
Returns the number of dimensions (sometimes referred to as
rank
) of the Tensor.

int 
numElements
()
Returns the number of elements in a flattened (1D) view of the tensor.

Tensor.QuantizationParams 
quantizationParams
()
Returns the quantization parameters of the tensor within the owning
Interpreter
.

int[]  
int[] 
shapeSignature
()
Returns the original
shape
of the Tensor,
i.e., the sizes of each dimension  before any resizing was performed.

Inherited Methods
Public Methods
public int numBytes ()
Returns the size, in bytes, of the tensor data.
public int numDimensions ()
Returns the number of dimensions (sometimes referred to as rank ) of the Tensor.
Will be 0 for a scalar, 1 for a vector, 2 for a matrix, 3 for a 3dimensional tensor etc.
public int numElements ()
Returns the number of elements in a flattened (1D) view of the tensor.
public Tensor.QuantizationParams quantizationParams ()
Returns the quantization parameters of the tensor within the owning
Interpreter
.
Only quantized tensors have valid
QuantizationParameters
. For tensor that are not
quantized, the values of scale and zero_point are both 0.
public int[] shape ()
Returns the shape of the Tensor, i.e., the sizes of each dimension.
Returns
 an array where the ith element is the size of the ith dimension of the tensor.
public int[] shapeSignature ()
Returns the original shape of the Tensor, i.e., the sizes of each dimension  before any resizing was performed. Unknown dimensions are designated with a value of 1.
Returns
 an array where the ith element is the size of the ith dimension of the tensor.