UNPKG

tractjs

Version:

A library for running ONNX and TensorFlow inference in the browser.

19 lines (16 loc) 544 B
import type { TypedArray } from "tractjs-core"; /** * A Tensor. The standard input and output type. * * Defined by a [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) and a shape. * * Data is stored in standard order i. e. `new Tensor(new Float32Array([1, 2, 3, 4]), [2, 2])` is comparable to `[[1, 2], [3, 4]]`. */ export class Tensor { data: TypedArray; shape: number[]; constructor(data: TypedArray, shape: number[]) { this.data = data; this.shape = shape; } }