Transformer class

Minimal Transformer encoder wrapper. We provide a tiny, testable abstraction: token embeddings -> mean pooling -> MLP head (ANN).

Constructors

Transformer({required int vocabSize, int dModel = 64, int heads = 4, required List<int> headLayers, int? seed})

Properties

dModel → int
final
hashCode → int
The hash code for this object.
no setterinherited
final
heads → int
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
vocabSize → int
final

Methods

fit(List<List<int>> X, List<List<double>> Y, {int? batchSize, bool verbose = false}) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
predict(List<List<int>> X) → List<List<double>>
toJson() → String
toMap() → Map<String, dynamic>
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

fromJson(String s, {int? seed}) → Transformer
fromMap(Map<String, dynamic> m, {int? seed}) → Transformer