primeCrossAttn method

void primeCrossAttn(
  1. Tensor xa
)

Pre-project encoder memory xa: [B, T_audio, C] (B == 1 in practice) into this block's cross-attention K and V. Must be called once per audio clip before call.

Implementation

void primeCrossAttn(Tensor xa) {
  final b = xa.shape[0];
  final t = xa.shape[1];
  final c = xa.shape[2];
  final flat = xa.reshape([b * t, c]);
  _crossK = [for (final h in crossKHeads) h(flat)];
  _crossV = [for (final h in crossVHeads) h(flat)];
}