Interface TensorConstructor#
interface TensorConstructor {
new TensorConstructor (type, shape): Tensor;
new TensorConstructor (type, shape, tensorData): Tensor;
}
This interface contains constructors of the Tensor class.
The tensor memory is shared with the TypedArray
. That is,
the responsibility for maintaining the reference to the TypedArray
lies with
the user. Any action performed on the TypedArray
will be reflected in this
tensor memory.
Defined in: addon.ts:421
Constructors#
constructor
new TensorConstructor(type, shape): Tensor
It constructs a tensor using the element type and shape. The new tensor data will be allocated by default.
Parameters:
type: elementTypeString | element
The element type of the new tensor.
shape: number[]
The shape of the new tensor.
Returns: Tensor
Defined in: addon.ts:428
new TensorConstructor(type, shape, tensorData): Tensor
It constructs a tensor using the element type and shape. The new tensor wraps allocated host memory.
Parameters:
type: elementTypeString | element
The element type of the new tensor.
shape: number[]
The shape of the new tensor.
tensorData: SupportedTypedArray
A subclass of TypedArray that will be wrapped by a Tensor
Returns: Tensor
Defined in: addon.ts:437
new TensorConstructor(tensorData: string[]): Tensor;
It constructs a string tensor. The strings from the array are used to fill tensor data. Each element of a string tensor is a string of arbitrary length.
Returns: Tensor
Defined in: addon.ts:444