So

Do not use .data. That is not a thing anymore.
In this case, you want to clone the weights, otherwise you comparison compare twice the same Tensor: w3 = model.layer3.weight.detach().clone().
layer1 and layer2 are expected not to change. layer3 will see change after you add the clone.