public final class Tensor extends Object
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.
Modifier and Type | Method and Description |
---|---|
DataType |
dataType()
Returns the
DataType of elements stored in the Tensor. |
int |
index()
Returns the (global) index of the tensor within the owning
Interpreter . |
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 (1-D) view of the tensor.
|
int[] |
shape()
Returns the shape of
the Tensor, i.e., the sizes of each dimension.
|
public int numDimensions()
Will be 0 for a scalar, 1 for a vector, 2 for a matrix, 3 for a 3-dimensional tensor etc.
public int numBytes()
public int numElements()
public int[] shape()
public int index()
Interpreter
.Copyright © 2022. All rights reserved.