Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/netsaur/packages/utilities/mod.ts>Tensor

Powerful machine learning, accelerated by WebGPU
Go to Latest
class Tensor
implements Sliceable, TensorLike<DT, O>
Re-export
import { Tensor } from "https://deno.land/x/netsaur@0.4.0-patch/packages/utilities/mod.ts";

A Tensor of order O.

Constructors

new
Tensor(tensor: TensorLike<DT, O>)
new
Tensor(array: NDArray<DT>[O], dType: DT)
new
Tensor(data: DType<DT>, shape: Shape<O>)
new
Tensor(dType: DT, shape: Shape<O>)
new
Tensor(data:
| NDArray<DT>[O]
| DType<DT>
| DT
, shape?: Shape<O> | DType<DT>
)

Type Parameters

DT extends DataType
O extends Order

Properties

data: DType<DT>
dType: DT
readonly
length: number

For compat with useSplit()

order: O
shape: Shape<O>
strides: Shape<O>

Methods

filter(fn: (
value: DType<DT>,
row: number,
_: DType<DT>[],
) => boolean
): Tensor<DT, O>

Filter the tensor by 0th axis

item(...indices: number[]): DTypeValue<DT>

Get an item using indices

slice(
start?,
end?: number,
axis?,
): Tensor<DT, O>

Slice matrix by axis

toJSON(): { data: DTypeValue<DT>[]; shape: Shape<O>; }