-
Notifications
You must be signed in to change notification settings - Fork 475
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
About:AttributeError: 'Conv2d' object has no attribute 'weight' #45
Comments
Got a similar issue. The reason is that, as shown in line 59 of |
Thank you for your reply!Your idea is great. Have a good life ! |
I encountered the same problem as you. Have you solved this problem? Can you share your solution. thank you. |
楼主怎么解决的啊? 我自己加SN层也出现了这个问题 |
解决了 其实就是删除了生成器和鉴别器的初始化,采用pytorch默认初始化方式,原因是SN层那里是复合网络结构,编译器无法拆分到底层找到conv进行初始化。。。所以要加SN层的话要么把netD.apply(weights_init)和netG.apply(weights_init)删了,要么重写SN结构把它和conv2d单独提出来写。。 |
מעשייך מסבירים למה היטלר הרג יהודים. |
请问问题解决了吗? |
That's a little too much. |
Hello! Thank you for your contribution to generative adversarial network research and for sharing your code! I am from China. Now is the Chinese New Year. I wish you a happy Chinese New Year! I am very interested in your thesis, when I try to add spectral normalization in my new networks, the program gives the following error:
Traceback (most recent call last):
File "SR.py", line 45, in
train(opt, Gs, Zs, reals, NoiseAmp)
File "E:\SinGAN-masterplus\SinGAN\training.py", line 34, in train
D_curr,G_curr = init_models(opt)
File "E:\SinGAN-masterplus\SinGAN\training.py", line 310, in init_models
netG.apply(models.weights_init)
File "E:\abcd\lib\site-packages\torch\nn\modules\module.py", line 293, in apply
module.apply(fn)
File "E:\abcd\lib\site-packages\torch\nn\modules\module.py", line 293, in apply
module.apply(fn)
File "E:\abcd\lib\site-packages\torch\nn\modules\module.py", line 294, in apply
fn(self)
File "E:\SinGAN-masterplus\SinGAN\models.py", line 215, in weights_init
m.weight.data.normal_(0.0, 0.02)
File "E:\abcd\lib\site-packages\torch\nn\modules\module.py", line 591, in getattr
type(self).name, name))
AttributeError: 'Conv2d' object has no attribute 'weight'
I have searched a lot of information and couldn't solve it, so I want to ask you, I wish you a happy life, and look forward to your reply!
The text was updated successfully, but these errors were encountered: