So:

You convert to a python object, so the autograd cannot work. You need to only use pytorch tensors.
You detach() so you explicitly ask for not gradient to flow back to the weight
The value you use is independent of the weight, so it won’t have any gradient.

In all cases, you won’t have any gradient for self.weight. So it is expected that it won’t be updated.