EmbeddingOutputContract enum
How to turn a ForwardResult into the final embedding vector.
The dispatch MUST be on this enum, never on ForwardResult.shape — a
rank-2 [1, dim] result from an engine that already pools+normalizes
internally (LiteRT) must NOT be routed through meanPoolAndNormalize a
second time (that would silently add an L2-normalize the LiteRT path
never had — see this file's module doc / the embedder decoupling plan's
Invariant I0). meanPoolAndNormalize lives in pooling.dart and is
applied by the generalized worker (embedding_worker.dart) based on this
contract.
Values
- pooledFinal → const EmbeddingOutputContract
-
ForwardResult IS the final embedding already — copy
valuesverbatim (List<double>.of(result.values)). No pooling, no normalization. Used by LiteRT: whatever pooling/normalization exists is baked into the compiled.tflitegraph and is opaque to Dart. - tokenLevel → const EmbeddingOutputContract
-
ForwardResult is
[1, seq, dim]per-token hidden states. ApplymeanPoolAndNormalize(mean-pool overseq, then L2-normalize) to get the final embedding. Used by engines (e.g. ONNX) that expose raw hidden states rather than a pooled output.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
EmbeddingOutputContract> - A constant List of the values in this enum, in order of their declaration.