Hello,
no, I’m suggesting that you do things as you would and when it comes to updating the tensor, you use one of the two on somevariable.data.
So the most typical case of updating a variable is in the optimizers, there you can see that update modifies the .data of the Variables (well Parameters, but that’s the same for this here)

  
      github.com
  
  
    pytorch/pytorch/blob/master/torch/optim/sgd.py#L98

            param_state = self.state[p]
            if 'momentum_buffer' not in param_state:
                buf = param_state['momentum_buffer'] = torch.zeros_like(p.data)
                buf.mul_(momentum).add_(d_p)
            else:
                buf = param_state['momentum_buffer']
                buf.mul_(momentum).add_(1 - dampening, d_p)
            if nesterov:
                d_p = d_p.add(momentum, buf)
            else:
                d_p = buf


        p.data.add_(-group['lr'], d_p)


return loss



  
  
    
    
  
  


Best regards
Thomas