Chapter 12 - Research Question why can forward start with h=0?

In chapter 12, can someone help with understanding why we set the hidden state (h) to 0 and not torch.zeros(n_hidden,n_hidden) ? (This is also a research question). I tried re-reading the chapter but couldn’t think of a reasonScreenshot 2020-12-16 at 8.00.23 AM

The first time through the loop, the scalar h is broadcast across the self.i_h tensor. After that happens, h itself becomes a tensor. The other way, h=torch.zeros(n_hidden,n_hidden), would have the same effect.

HTH, :slightly_smiling_face:

1 Like

So we can use either if we want?
Initialising it zero is just making things easier.

Yes. It is just a Python programming style issue, nothing to do with machine learning in particular.