Class NDArray

n-dimnesional array.

Hierarchy

  • NDArray

Implements

Constructors

Properties

device: DLDevice

Device of the array.

dtype: string

Data type of the array.

isView: boolean

Whether it is a temporary view that can become invalid after the call.

ndim: number

Number of dimensions.

shape: number[]

Shape of the array.

Methods

  • Copy data from another NDArray or javascript array. The number of elements must match.

    Parameters

    • data: number[] | Float32Array | NDArray

      The source data array.

    Returns NDArray

    this

  • Copy data from raw bytes.

    Parameters

    • data: Uint8Array

      Uint8Array of bytes.

    Returns NDArray

    this

  • Dispose the internal resource This function can be called multiple times, only the first call will take effect.

    Returns void

  • Get dataPtr of NDarray

    Returns number

    The handle.

  • Get handle of ndarray, check it is not null.

    Parameters

    • requireNotNull: boolean = true

      require handle is not null.

    Returns number

    The handle.

  • Return a TypedArray copy of the NDArray, the specific type depends on the dtype of the NDArray.

    Returns Uint8Array | Int32Array | Float32Array | Float64Array | Int8Array

    The result array.

  • Return a copied Uint8Array of the raw bytes in the NDArray.

    Returns Uint8Array

    The result array.

  • Create a view of the array.

    Parameters

    • shape: number[]

      The shape of the view.

    • Optional dtype: string

      The data type of the new array.

    Returns NDArray

    The new sliced ndarray.

Generated using TypeDoc