News for hackers. Stuff that matters.
Re:Neural network from scratch by gbersac on Wednesday January 05, 2022 @05:57AM (#29807530)
Interesting read, but there's a few things I haven't understood. In the training [function](https://colab.research.google.com/drive/1YRp9k_ORH4wZMqXLNkc...):

1- In the instruction `hidden_layer.data[index] -= learning_rate * hidden_layer.grad.data[index]`where was the `hidden_layer.grad` value updated?

2- from what I've understood, we'll update the hidden_layer according to the inclination of the error function (because we want to minimize it). But where are `error.backward()` and `hidden_layer.grad` interconnected?

Re:Neural network from scratch by Sirupsen on Wednesday January 05, 2022 @06:25AM (#29807704)
Great questions, I struggled with this part the most when I was learning it.

`.grad` is set by `autograd` when calling `backward()`

Probably the easiest way to understand this is to play a bit with `.grad` and `backward()` on their own, with the first code sample in the `autograd` section [1].

[1]: https://sirupsen.com/napkin/neural-net#automagically-computi...

Re:Neural network from scratch by gbersac on Wednesday January 05, 2022 @07:33AM (#29808173)
Thank you!
Re:Neural network from scratch by cercatrova on Wednesday January 05, 2022 @02:23PM (#29813621)
FYI Markdown type links don't work on HN, that's why you see people type footnotes [0]

[0] like this