Challenge: Implementing Scaled Dot-Product Attention
メニューを表示するにはスワイプしてください
Task
You now have all the pieces to implement scaled dot-product attention from scratch. Using the formula from the previous chapter, write a function scaled_dot_product_attention that:
- Takes
Q,K,Vtensors of shape(batch_size, seq_len, d_k)as input; - Accepts an optional
masktensor of shape(batch_size, seq_len_q, seq_len_k)— when provided, positions wheremask == 0should be set to-infbefore softmax; - Returns the output tensor and the attention weights.
Implement the function locally.
すべて明確でしたか?
フィードバックありがとうございます!
セクション 1. 章 3
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください
セクション 1. 章 3