I’m not sure if your current use case changed, but you should not reassign parameters in the forward method, as they won’t be trained (in case you are fine-tuning the model).
Did you try to use the previously posted approach?