new_w doesn’t seem to be used in the second code snippet so the difference seems to be the .data assignment.
Could you remove the .data usage and assign the weight via:
with torch.no_grad():
    model.conv.weight = nn.Parameter(w)

and rerun the test?