Interface Tensor#
interface Tensor {
data: SupportedTypedArray;
getElementType(): element;
getData(): SupportedTypedArray;
getShape(): number[];
getSize(): number;
}
The Tensor
is a lightweight class that represents data used for
inference. There are different ways to create a tensor. You can find them
in TensorConstructor section.
Defined in: addon.ts:390
Properties#
data
data: SupportedTypedArray
This property provides access to the tensor’s data.
Its getter returns a subclass of TypedArray that corresponds to the tensor element type, e.g.
Float32Array
corresponds tofloat32
. The content of theTypedArray
subclass is a copy of the tensor underlaying memory.Its setter fills the underlaying tensor memory by copying the binary data buffer from the
TypedArray
subclass. An exception will be thrown if the size or type of array does not match the tensor.Defined in: addon.ts:403
Methods#
getData
getData(): SupportedTypedArray;
It gets tensor data.
Returns: SupportedTypedArray
A subclass of
TypedArray
corresponding to the tensor element type, e.g.Float32Array
corresponds to float32.Defined in: addon.ts:413
getElementType
getElementType(): element
It gets the tensor element type.
Returns: element
Defined in: addon.ts:407
getShape
getShape(): number[]
It gets the tensor shape.
Returns: number[]
Defined in: addon.ts:417
getSize
getSize(): number[]
It gets the tensor size as a total number of elements.
Returns: number[]
Defined in: addon.ts:421