The difference between torch.tensor.data and torch.tensor

Hi,

You can do either

with torch.no_grad():
  w *= i

Or if you need cannot do it inplace directly:

with torch.no_grad():
  w.copy_(w * i)
2 Likes