Thank you for your reply.
I used model.apply, it is giving this error:
File "...", line 308, in <module>
    net.apply(xavier_init)      
  File "...", line 293, in apply
    module.apply(fn)
  File "...", line 293, in apply
    module.apply(fn)
  File "...", line 294, in apply
    fn(self)
  File "...", line 191, in xavier_init
    m.bias.data.zero_()
AttributeError: 'NoneType' object has no attribute 'data'