Can you clarify what do you mean by “keep tasked”?
weights.grad_fn  is none because the gradients would be computed wrt weights. At the end when you finally get a scalar and call .backward the right gradients will be calculated in weights.grad. You can use an optimizer or manually update the weights from there.
I assume this is solved now?