Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'fill_' #44

Open
Mr-doraemon opened this issue Aug 16, 2021 · 1 comment
Open

AttributeError: 'NoneType' object has no attribute 'fill_' #44

Mr-doraemon opened this issue Aug 16, 2021 · 1 comment

Comments

@Mr-doraemon
Copy link

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

@AlexHex7
Copy link
Owner

AlexHex7 commented Aug 30, 2021

@Mr-doraemon Hi, it seems that self.W[1].weight is None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants