Error Using Spectral Normalization code

Hello,

I am getting following error, while running the Spectral Normlization Code at https://github.com/pytorch/pytorch/blob/master/torch/nn/utils/spectral_norm.py

  File "/usr/local/torch4/lib/python3.5/site-packages/torch/nn/modules/module.py", line 487, in __call__
    hook(self, input)
  File "/home/bansa01/pytorch_wideres/tmp_spectral_norm/WideResNet-pytorch/spectral_norm.py", line 43, in __call__
    setattr(module, self.name, weight)
  File "/usr/local/torch4/lib/python3.5/site-packages/torch/nn/modules/module.py", line 551, in __setattr__
    .format(torch.typename(value), name))
TypeError: cannot assign 'torch.cuda.FloatTensor' as parameter 'weight' (torch.nn.Parameter or None expected)

While this function is called:

    def __call__(self, module, inputs):
        print ("In Call Function")
        weight, u = self.compute_weight(module)
        setattr(module, self.name, weight)
        setattr(module, self.name + '_u', u)

Not sure what I am doing incorrect here. Please suggest!
Thanks!