Multi-Head Self-Attention in NumPy

Implement a simplified multi-head self-attention forward pass by hand using NumPy. For simplicity, the Q/K/V projections and the output projection are identity (i.e. Q = K = V = X), with no mask. ...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: