JJoeven

Exercises / transformers

Normalize attention weights

Given raw scores [2, 0, 0], turn them into a probability vector with softmax (math.exp). Print the weights rounded to 3 decimals and check they sum to 1.

Live Pythonpython
Output
Run to execute this in your browser. Nothing is sent to a server.