# TensorConstructor | ONNX Runtime JavaScript API
Documentation for ONNX Runtime JavaScript API

### Hierarchy

- TensorConstructor

## Index

### Constructors

- constructor

## Constructors

### constructor

- new TensorConstructor(type: "string", data: readonly string[] | string[], dims?: readonly number[]): TypedTensor <"string">
- new TensorConstructor(type: "bool", data: Uint8Array | readonly boolean[], dims?: readonly number[]): TypedTensor <"bool">
- new TensorConstructor<T>(type: T, data: readonly number[] | DataTypeMap [T], dims?: readonly number[]): TypedTensor <T>
- new TensorConstructor(data: Float32Array, dims?: readonly number[]): TypedTensor <"float32">
- new TensorConstructor(data: Int8Array, dims?: readonly number[]): TypedTensor <"int8">
- new TensorConstructor(data: Uint8Array, dims?: readonly number[]): TypedTensor <"uint8">
- new TensorConstructor(data: Uint16Array, dims?: readonly number[]): TypedTensor <"uint16">
- new TensorConstructor(data: Int16Array, dims?: readonly number[]): TypedTensor <"int16">
- new TensorConstructor(data: Int32Array, dims?: readonly number[]): TypedTensor <"int32">
- new TensorConstructor(data: BigInt64Array, dims?: readonly number[]): TypedTensor <"int64">
- new TensorConstructor(data: readonly string[], dims?: readonly number[]): TypedTensor <"string">
- new TensorConstructor(data: readonly boolean[], dims?: readonly number[]): TypedTensor <"bool">
- new TensorConstructor(data: Float64Array, dims?: readonly number[]): TypedTensor <"float64">
- new TensorConstructor(data: Uint32Array, dims?: readonly number[]): TypedTensor <"uint32">
- new TensorConstructor(data: BigUint64Array, dims?: readonly number[]): TypedTensor <"uint64">
- new TensorConstructor(type: keyof DataTypeMap, data: readonly number[] | readonly boolean[] | DataType, dims?: readonly number[]): Tensor
- new TensorConstructor(data: DataType, dims?: readonly number[]): Tensor

- - Defined in tensor.ts:93

  Construct a new string tensor object from the given type, data and dims.

  #### Parameters

  - ##### type: "string"

    Specify the element type.

  - ##### data: readonly string[] | string[]

    Specify the tensor data

  - ##### Optional dims: readonly number[]

    Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.

  #### Returns TypedTensor <"string">

- - Defined in tensor.ts:103

  Construct a new bool tensor object from the given type, data and dims.

  #### Parameters

  - ##### type: "bool"

    Specify the element type.

  - ##### data: Uint8Array | readonly boolean[]

    Specify the tensor data

  - ##### Optional dims: readonly number[]

    Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.

  #### Returns TypedTensor <"bool">

- - Defined in tensor.ts:112

  Construct a new numeric tensor object from the given type, data and dims.

  #### Type parameters

  - #### T: "float32" | "uint8" | "int8" | "uint16" | "int16" | "int32" | "int64" | "float16" | "float64" | "uint32" | "uint64"

  #### Parameters

  - ##### type: T

    Specify the element type.

  - ##### data: readonly number[] | DataTypeMap [T]

    Specify the tensor data

  - ##### Optional dims: readonly number[]

    Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.

  #### Returns TypedTensor <T>

- - Defined in tensor.ts:124

  Construct a new float32 tensor object from the given data and dims.

  #### Parameters

  - ##### data: Float32Array

    Specify the tensor data

  - ##### Optional dims: readonly number[]

    Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.

  #### Returns TypedTensor <"float32">

- - Defined in tensor.ts:132

  Construct a new int8 tensor object from the given data and dims.

  #### Parameters

  - ##### data: Int8Array

    Specify the tensor data

  - ##### Optional dims: readonly number[]

    Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.

  #### Returns TypedTensor <"int8">

- - Defined in tensor.ts:140

  Construct a new uint8 tensor object from the given data and dims.

  #### Parameters

  - ##### data: Uint8Array

    Specify the tensor data

  - ##### Optional dims: readonly number[]

    Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.

  #### Returns TypedTensor <"uint8">

- - Defined in tensor.ts:148

  Construct a new uint16 tensor object from the given data and dims.

  #### Parameters

  - ##### data: Uint16Array

    Specify the tensor data

  - ##### Optional dims: readonly number[]

    Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.

  #### Returns TypedTensor <"uint16">

- - Defined in tensor.ts:156

  Construct a new int16 tensor object from the given data and dims.

  #### Parameters

  - ##### data: Int16Array

    Specify the tensor data

  - ##### Optional dims: readonly number[]

    Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.

  #### Returns TypedTensor <"int16">

- - Defined in tensor.ts:164

  Construct a new int32 tensor object from the given data and dims.

  #### Parameters

  - ##### data: Int32Array

    Specify the tensor data

  - ##### Optional dims: readonly number[]

    Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.

  #### Returns TypedTensor <"int32">

- - Defined in tensor.ts:172

  Construct a new int64 tensor object from the given data and dims.

  #### Parameters

  - ##### data: BigInt64Array

    Specify the tensor data

  - ##### Optional dims: readonly number[]

    Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.

  #### Returns TypedTensor <"int64">

- - Defined in tensor.ts:180

  Construct a new string tensor object from the given data and dims.

  #### Parameters

  - ##### data: readonly string[]

    Specify the tensor data

  - ##### Optional dims: readonly number[]

    Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.

  #### Returns TypedTensor <"string">

- - Defined in tensor.ts:188

  Construct a new bool tensor object from the given data and dims.

  #### Parameters

  - ##### data: readonly boolean[]

    Specify the tensor data

  - ##### Optional dims: readonly number[]

    Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.

  #### Returns TypedTensor <"bool">

- - Defined in tensor.ts:196

  Construct a new float64 tensor object from the given data and dims.

  #### Parameters

  - ##### data: Float64Array

    Specify the tensor data

  - ##### Optional dims: readonly number[]

    Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.

  #### Returns TypedTensor <"float64">

- - Defined in tensor.ts:204

  Construct a new uint32 tensor object from the given data and dims.

  #### Parameters

  - ##### data: Uint32Array

    Specify the tensor data

  - ##### Optional dims: readonly number[]

    Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.

  #### Returns TypedTensor <"uint32">

- - Defined in tensor.ts:212

  Construct a new uint64 tensor object from the given data and dims.

  #### Parameters

  - ##### data: BigUint64Array

    Specify the tensor data

  - ##### Optional dims: readonly number[]

    Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.

  #### Returns TypedTensor <"uint64">

- - Defined in tensor.ts:225

  Construct a new tensor object from the given type, data and dims.

  #### Parameters

  - ##### type: keyof DataTypeMap

    Specify the element type.

  - ##### data: readonly number[] | readonly boolean[] | DataType

    Specify the tensor data

  - ##### Optional dims: readonly number[]

    Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.

  #### Returns Tensor

- - Defined in tensor.ts:233

  Construct a new tensor object from the given data and dims.

  #### Parameters

  - ##### data: DataType

    Specify the tensor data

  - ##### Optional dims: readonly number[]

    Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.

  #### Returns Tensor

Generated using TypeDoc