Non-local_pytorch
Non-local_pytorch copied to clipboard
AttributeError: 'NoneType' object has no attribute 'fill_'
I want to embed this non-local code in my framework, but when I run my code, the following error will occur:
File "/home/Global/models/non_local_embeded_gaussian.py", line 102, in init super(NONLocalBlock2D, self).init(in_channels, File "/home/Global/models/non_local_embeded_gaussian.py", line 54, in init nn.init.constant_(self.W[1].weight, 0) File "/home/anaconda3/envs/torch/lib/python3.8/site-packages/torch/nn/init.py", line 176, in constant_ return no_grad_fill(tensor, val) File "/home/anaconda3/envs/torch/lib/python3.8/site-packages/torch/nn/init.py", line 59, in no_grad_fill return tensor.fill_(val) AttributeError: 'NoneType' object has no attribute 'fill_'
In my envirnoment, the pyhton version: 3.8, torch version: 1.8.0, cuda:11.2
@Mr-doraemon Hi, it seems that self.W[1].weight is None.