title: what is the use of .data in pytorch
body: <p>I just got the code from <a href="https://github.com/heykeetae/Self-Attention-GAN" rel="nofollow noreferrer">https://github.com/heykeetae/Self-Attention-GAN</a> (the file is spectral.py). Partial code is under there. I don't really understand what is the use of the .data, is this a method in some class? if it is, which class does it belong to?</p>
  
  <pre><code>import torch
  from torch.optim.optimizer import Optimizer, required
  from torch.autograd import Variable
  import torch.nn.functional as F
  from torch import nn
  from torch import Tensor
  from torch.nn import Parameter
  
  def l2normalize(v, eps=1e-12):
      return v / (v.norm() + eps)
  
  
  class SpectralNorm(nn.Module):
  
      def _make_params(self):
          w = getattr(self.module, self.name)
  
          height = w.data.shape[0]
          width = w.view(height, -1).data.shape[1]
  
          u = Parameter(w.data.new(height).normal_(0, 1), requires_grad=False)
          v = Parameter(w.data.new(width).normal_(0, 1), requires_grad=False)
          u.data = l2normalize(u.data)
          v.data = l2normalize(v.data)
          w_bar = Parameter(w.data)
  </code></pre>