yonatansc97:

I have checked the gradients of the parameters right after initialization (with pycharm’s debugger), and also during the forward pass, and in both cases the .requires_grad=True, but .grad=None.


This is expected, since no gradient are calculated after the parameters are initialized or after only the forward pass was executed.
The gradients will be calculated in the backward() call and you should see valid values in the .grad attributes afterwards.