TransformerEncoder class

Inheritance

Constructors

TransformerEncoder({required int vocabSize, required int embedSize, required int blockSize, int numLayers = 6, int numHeads = 8})

Properties

blocks → List<TransformerEncoderBlock>
final
blockSize → int
final
embedSize → int
final
finalLayerNorm → LayerNorm
final
hashCode → int
The hash code for this object.
no setterinherited
numHeads → int
final
numLayers → int
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
vocabSize → int
final
wpe → Tensor
final
wte → Tensor
final

Methods

forward(List<int> idx, List<Tensor> tracker) → Tensor
idx: List of token IDs. tracker: List to collect intermediate tensors for disposal.
forwardEmbeddings(Tensor embeddedInputs, List<Tensor> tracker) → Tensor
Entry point for vision (image patches) or pre-embedded tokens
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parameters() → List<Tensor>
override
step(double lr) → void
inherited
toString() → String
A string representation of this object.
inherited
zeroGrad() → void
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited