Implement scaled dot-product attention with a causal mask in numpy

Transformer Architecture Internals1 / 7

Chapter 011 / 7

Transformer Architecture Internals

Implement scaled dot-product attention with a causal mask in numpy

Easy
Target interface
scaled_dot_product_attention(Q, K, V, causal=True)

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

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