CrossAttention class

A single head of cross-attention (Encoder-Decoder Attention).

This module allows tokens in the decoder's sequence (queries) to interact with and attend to tokens in the encoder's output sequence (keys and values).

Inheritance

Constructors

CrossAttention(int decoderEmbedSize, int encoderEmbedSize, int headSize)

Properties

hashCode int
The hash code for this object.
no setterinherited
headSize int
final
key Layer
final
query Layer
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value Layer
final

Methods

forward(List<ValueVector> x_decoder, List<ValueVector> x_encoder) List<ValueVector>
Forward pass for a single cross-attention head.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parameters() List<Value>
override
toString() String
A string representation of this object.
inherited
zeroGrad() → void
inherited

Operators

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