Implement multi-head attention from scratch in PyTorch incl

Transformer Architecture Internals3 / 7

Chapter 013 / 7

Transformer Architecture Internals

Implement multi-head attention from scratch in PyTorch incl

Medium

Implement multi-head attention from scratch in PyTorch incl. causal mask and output projection.

Target interface
class MultiHeadAttention

Implement the function/class skeleton in the editor. Any correct approach is accepted.

Hints0 / 2
Reference solution
Your own code stays in the editor.