Yeah, that’s fine here. The new style to express this is to use torch.no_grad() to signify that you don’t want to track the gradient of this operation (but z.data is OK too):
with torch.no_grad():
  z[some_indices] += my_noise_tensor