Toolstransformers from scratch · B of 4
Weight Times Sand
The second half of attention: the output. The cabinet is the one from figure A. Each drawer gives weight × its sand to one cup, and the cup adds the three parts. The total in the cup is the output.
~/tools/transformers/pour-cup
output 2.47 = .80×2 + .14×5 + .06×3
What is what
- Drawers
- Open by their weights, as in figure A. Drawer 1 is blue, drawer 2 orange, drawer 3 green.
- Sand
- The value of each token: 2, 5 and 3 units, in the color of its drawer.
- Cup window
- One layer for each drawer, weight × sand, drawer 1 at the bottom. The scale beside it reads the total.
- Readout
- The same sum as numbers, for example output 3.73 = .38×2 + .57×5 + .04×3.
How to play
- Moving the pointer left and right across the drawing turns the query, as in figure A.
- The arrow keys turn it 10° at a time. The 0 key points it straight up.
- With no input, the dial turns by itself.
- A drawer with a large weight gives a thick layer; a drawer that is almost shut gives almost nothing.
- The output always stays between 2 and 5, the smallest and the largest amount of sand.
- With the query straight up, the orange drawer has the largest weight, so the output leans toward 5.
Each drawer gives weight × value, and the cup adds the parts. Because the weights add up to 1, the output is a weighted average of the values. The directions of the arrows and the amounts of sand are examples.