karpathy / nn-zero-to-hero

Neural Networks: Zero to Hero
MIT License
11.63k stars 1.46k forks source link

TypeError: unsupported operand type(s) for +: 'int' and 'Value' #41

Closed EruditeBoen closed 9 months ago

EruditeBoen commented 9 months ago

When I run the following command from micrograd_lecture_second_half_roughly.ipynb:

[(yout - ygt)**2 for ygt, yout in zip(ys, ypred)]

I get a clean output:

[Value(data=1.8688676392069992)), Value(data=0.37661915959598025)), Value(data=0.13611849326555403)), Value(data=1.69235533142263))]

But whenever I tried to enclose it in a sum() function:

sum((yout - ygt)**2 for ygt, yout in zip(ys, ypred))

It throws an error:

TypeError: unsupported operand type(s) for +: 'int' and 'Value'

EruditeBoen commented 9 months ago

nvm :)