Algorithm · Amazon · Hard
This is a hands-on implementation exercise. Write code for the following three pieces of a transformer attention layer: Multi-head attention. Key-value (KV) caching for the attention computation, so that previously computed keys and values can be reused. The forward computation, using the KV cache, for grouped-query attention (GQA). The exact function interfaces, tensor shapes, cache layout and numerical examples were not specified. Examples are not available for this…