Hi @bsg_ssg
None is returned when the grad attribute isn’t populated during a backward call because of requires_grad being False for those tensors (parameters in your case).
Going by your code, I would say the for loop where you set params.requires_grad = True should be placed before any loss calculation or backward propagation is done.
It’d be best if you just place the params.requires_grad = True for loop outside the outermost for loop which is -
for i, j in train_loader_clean_ewc:
Let me know if you still face any errors after doing this.