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.

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.

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:392