You are manually overriding the .data attribute, which won’t trigger any shape checks, so it would be your responsibility to make sure the parameters are assigned properly using this approach.
With that being said, note that you should generally not use the .data attribute, as it could yield unwanted side effects. Instead, if you want to manually assign the parameters, wrap the assignment in a with torch.no_grad() block and use the .weight and .bias attributes.