Implement Scaled Dot-Product Attention

Asked at Google · Deep Learning & Architectures · Difficulty: Medium

Implement the forward pass of one scaled dot-product self-attention head with NumPy. Each token looks at every token that is allowed, takes a weighted average of their value vectors, and the weights come from how well its query matches their keys.

Loading the problem…