ptrblck:

new_w doesn’t seem to be used in the second code snippet so the difference seems to be the .data assignment.


This is a mistake, and I had re-edit the code snippet.



 ptrblck:

Could you remove the .data usage and assign the weight via:
with torch.no_grad():
    model.conv.weight = nn.Parameter(w)



And I tried this assignment method, but the results are different still.