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

TypeError: argument 0 is not a Variable #40

Closed
sbaban opened this issue Aug 30, 2018 · 1 comment
Closed

TypeError: argument 0 is not a Variable #40

sbaban opened this issue Aug 30, 2018 · 1 comment

Comments

@sbaban
Copy link

sbaban commented Aug 30, 2018

Hi, I run this code,but has a error,the outpout is:

Please install sklearn for layer visualization
Traceback (most recent call last):
File "/home/hang/PycharmProjects/pytorch/test.py", line 209, in
output = cnn(b_x)[0] # cnn output
File "/home/hang/.local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 357, in call
result = self.forward(*input, **kwargs)
File "/home/hang/PycharmProjects/pytorch/test.py", line 180, in forward
x = self.conv1(x)
File "/home/hang/.local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 357, in call
result = self.forward(*input, **kwargs)
File "/home/hang/.local/lib/python2.7/site-packages/torch/nn/modules/container.py", line 67, in forward
input = module(input)
File "/home/hang/.local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 357, in call
result = self.forward(*input, **kwargs)
File "/home/hang/.local/lib/python2.7/site-packages/torch/nn/modules/conv.py", line 282, in forward
self.padding, self.dilation, self.groups)
File "/home/hang/.local/lib/python2.7/site-packages/torch/nn/functional.py", line 90, in conv2d
return f(input, weight, bias)
TypeError: argument 0 is not a Variable

Process finished with exit code 1

还有一个问题,为什么代码与视频中的不一样?
是因为Variable的问题吗
谢谢

@MorvanZhou
Copy link
Owner

请pip安装一下 sklearn

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