Yes it’s element-wise.  In PyTorch, x.pow(2) and x ** 2 are equivalent:

  
      github.com
  
  
    pytorch/pytorch/blob/6f6d70ffeda9b9918b8fcd02ffea28b126e283e3/torch/tensor.py#L320-L321 146

def __pow__(self, other):
    return self.pow(other)



  
  
    
    
  
  


The ** operator (__pow__) just calls pow().