Could you explain what “freezes” means in this context? Is this parameter not getting any valid gradients?
Since the usage of the .data attribute is not recommended, you could wrap the code in a with torch.no_grad() block and remove the .data part. However, this might not get rid of the “freezing” issue.