Ah, you trace the model. I didn’t quite get that in your first post.
The main thing is that you likely want the weight to be recomputed in forward rather than computed once in __init__ and then stored self.weight.