leeyeehoo / CSRNet-pytorch

CSRNet: Dilated Convolutional Neural Networks for Understanding the Highly Congested Scenes
642 stars 259 forks source link

AttributeError: module 'torch.nn.init' has no attribute 'normal_' #45

Closed hipal3101 closed 3 years ago

hipal3101 commented 5 years ago

in val.ipynb file while executing model = CSRNet() i got this error:


AttributeError Traceback (most recent call last)

in () ----> 1 model = CSRNet() ~\CSRNet-pytorch-master\model.py in __init__(self, load_weights) 15 if not load_weights: 16 mod = models.vgg16(pretrained = True) ---> 17 self._initialize_weights() 18 for i in xrange(len(self.frontend.state_dict().items())): 19 self.frontend.state_dict().items()[i][1].data[:] = mod.state_dict().items()[i][1].data[:] ~\CSRNet-pytorch-master\model.py in _initialize_weights(self) 26 for m in self.modules(): 27 if isinstance(m, nn.Conv2d): ---> 28 nn.init.normal_(m.weight, std=0.01) 29 if m.bias is not None: 30 nn.init.constant_(m.bias, 0) AttributeError: module 'torch.nn.init' has no attribute 'normal_'
zhangliyun9120 commented 3 years ago

have you solved this problem?

hipal3101 commented 3 years ago

have you solved this problem?

Actually I don't remember now exactly. But Try running it on Google colab with GPU.