Tensor class

Constructors

Tensor.fill(List<int> shape, double val)
factory
Tensor.fromList(List<int> shape, List<double> vals)
factory

Properties

data List<double>
getter/setter pair
grad List<double>
no setter
handle Pointer<Void>
no setter
hashCode int
The hash code for this object.
no setterinherited
isView bool?
getter/setter pair
length int
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shape List<int>
latefinal

Methods

abs() Tensor
backward() → void
computeCostMatrix(Tensor gtBoxes) Tensor
computeCrossEntropy(Tensor pred, List<double> targets, int vocabSize, List<Tensor> tracker) Tensor
crossEntropy(List<int> targets) Tensor
detach() Tensor
dispose() → void
fetchData() Float32List
fetchRow(int row) List<double>
gelu() Tensor
getRow(int row) Tensor
log() Tensor
matmul(Tensor o) Tensor
Matrix Multiplication (Dot Product) Result shape: M, N
mean() Tensor
Collapses the entire tensor into a 1x1 Tensor containing the mean
mseLoss(Tensor target) Tensor
normalize({double eps = 1e-12}) Tensor
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pow(double e) Tensor
printGradient() String
printMatrix() String
relu() Tensor
reshape(List<int> newShape) Tensor
sigmoid() Tensor
slice(int startRow, int rowCount) Tensor
softmax() Tensor
step(double lr) → void
sum() Tensor
toString() String
A string representation of this object.
inherited
zeroGrad() → void

Operators

operator *(dynamic o) Tensor
Element-wise Multiplication (Hadamard Product) Use this for Causal Masking!
operator +(dynamic o) Tensor
operator -(dynamic o) Tensor
operator /(dynamic o) Tensor
operator ==(Object other) bool
The equality operator.
inherited
operator unary-() Tensor

Static Methods

aft(Tensor q, Tensor k, Tensor v, Tensor wb, bool masked) Tensor
aftCross(Tensor q, Tensor k, Tensor v, Tensor wb) Tensor
concat(List<Tensor> tensors) Tensor
embeddings(List<int> idx, Tensor wte, Tensor wpe) Tensor
l2Normalize(Tensor input, List<Tensor> tracker, {double eps = 1e-12}) Tensor
layerNorm(Tensor x, Tensor gamma, Tensor beta, double eps) Tensor
random(List<int> shape, {double scale = 0.005}) Tensor
zeros(List<int> shape) Tensor