Oh, I see. So in my example above, the backward computation will use the manipulated value of y1 (i.e. temp) instead of the original one (i.e. w1x), right?
But for the this code blow:
# method 1
y = wx
temp = w1x1
y.data = temp.data

# method 2
y = wx
temp = w1x1
y += (temp - y).detach_()

I still think they are equivalent, since during the backward computation, the value of y will be changed to temp in both cases. Please correct me if I’m wrong.