Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Explain when we can use additive attention as the scoring function. 2. Write a Python class program that implement additive attention. Demonstrate AdditiveAttention class
1. Explain when we can use additive attention as the scoring function.
2. Write a Python class program that implement additive attention. Demonstrate AdditiveAttention class with a toy example, where shapes (batch size, number of steps or sequence length in tokens, feature size) of queries, keys, and values are (2, 1, 20), (2, 10, 2), and (2, 10, 4), respectively. Show attention weights with heatmap.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started