I would not add .requires_grad = True randomly to the code, as it won’t fix the issue, but could mask it instead, so I would stick to the previously mentioned debugging: check the .grad_fn of all intermediates starting at the beginning of the model (i.e. the output of the first layer) and check, which activation shows .grad_fn = None. To do so you can either check it manually in the forward of each module or use forward hooks.