What happens when micrograd adds two Values?
A lesson on karpathy/micrograd, a GitHub repo. Computing, college level.
In micrograd, a Value holds one number.
When you add two Values, you do not just get a plain number back.
The add step makes a brand new Value.
Its data is the sum, self.data + other.data.
The new Value also keeps its two inputs in a list called _children.
It saves the sign '+' as _op, a note of which step made it.
Multiply works the same way, saving '*'.
Questions in this lesson
- Imagine a spreadsheet cell that adds two other cells, like =A1+B1. What do you think the cell keeps besides the final number?
- In your own words, what happens when micrograd adds two Values, and what does the result remember?