This is the error
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-67-4c1227c7febc> in <module>
      1 G =Generator().to(device)
----> 2 G.apply(initialize_weights)
      3 
      4 summary(G)

~\anaconda3\envs\st\lib\site-packages\torch\nn\modules\module.py in apply(self, fn)
    471         """
    472         for module in self.children():
--> 473             module.apply(fn)
    474         fn(self)
    475         return self

~\anaconda3\envs\st\lib\site-packages\torch\nn\modules\module.py in apply(self, fn)
    471         """
    472         for module in self.children():
--> 473             module.apply(fn)
    474         fn(self)
    475         return self

~\anaconda3\envs\st\lib\site-packages\torch\nn\modules\module.py in apply(self, fn)
    472         for module in self.children():
    473             module.apply(fn)
--> 474         fn(self)
    475         return self
    476 

<ipython-input-57-77b5d20a0bc3> in initialize_weights(m)
     13 def initialize_weights(m):
     14     if isinstance(m, nn.Linear):
---> 15         nn.init.xavier_uniform_(m.weight.data)
     16         m.bias.data.fill_(0)
     17 

~\anaconda3\envs\st\lib\site-packages\torch\nn\modules\module.py in __getattr__(self, name)
    946                 return modules[name]
    947         raise AttributeError("'{}' object has no attribute '{}'".format(
--> 948             type(self).__name__, name))
    949 
    950     def __setattr__(self, name: str, value: Union[Tensor, 'Module']) -> None:

AttributeError: 'Linear' object has no attribute 'weight'