class_docstr: Implementation of "Weight Normalization: A Simple Reparameterization
  to Accelerate Training of Deep Neural Networks"
  :cite:`DBLP:journals/corr/SalimansK16`
  
  As a reparameterization method, weight normalization is same
  as BatchNormalization, but it doesn't depend on minibatch.
  
  NOTE: This is used nowhere in the code at this stage
        Vincent Nguyen 05/18/2018
class_docstr_tok: ["Implementation","of","``","Weight","Normalization",":","A","Simple","Reparameterization","to","Accelerate","Training","of","Deep","Neural","Networks","''",":","cite",":","`","DBLP",":","journals\/corr\/SalimansK16","`","As","a","reparameterization","method",",","weight","normalization","is","same","as","BatchNormalization",",","but","it","does","n't","depend","on","minibatch",".","NOTE",":","This","is","used","nowhere","in","the","code","at","this","stage","Vincent","Nguyen","05\/18\/2018"]
code: def forward(self, x, init=False):
      if init is True:
          # out_features * in_features
          self.V.data.copy_(
              torch.randn(self.V.data.size()).type_as(self.V.data)
              * 0.05
          )
          # norm is out_features * 1
          v_norm = self.V.data / self.V.data.norm(2, 1).expand_as(
              self.V.data
          )
          # batch_size * out_features
          x_init = F.linear(x, v_norm).data
          # out_features
          m_init, v_init = x_init.mean(0).squeeze(0), x_init.var(
              0
          ).squeeze(0)
          # out_features
          scale_init = self.init_scale / torch.sqrt(v_init + 1e-10)
          self.g.data.copy_(scale_init)
          self.b.data.copy_(-m_init * scale_init)
          x_init = scale_init.view(1, -1).expand_as(x_init) * (
              x_init - m_init.view(1, -1).expand_as(x_init)
          )
          self.V_avg.copy_(self.V.data)
          self.g_avg.copy_(self.g.data)
          self.b_avg.copy_(self.b.data)
          return x_init
      else:
          v, g, b = get_vars_maybe_avg(
              self,
              ["V", "g", "b"],
              self.training,
              polyak_decay=self.polyak_decay,
          )
          # batch_size * out_features
          x = F.linear(x, v)
          scalar = g / torch.norm(v, 2, 1).squeeze(1)
          x = scalar.view(1, -1).expand_as(x) * x + b.view(
              1, -1
          ).expand_as(x)
          return x
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from torch.nn import Parameter
label_desc: Use image node_id 3 for calling the WeightNormLinear obj's underlying member method code with example usage: obj.forward(x, init) and returns: x_init, x