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

I need some help! Expected 2D (unbatched) or 3D (batched) input to conv1d #34

Open
StevDL-gif opened this issue Sep 5, 2022 · 12 comments

Comments

@StevDL-gif
Copy link

Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\Graph-WaveNet-master\train.py", line 177, in
main()
File "C:\Users\Administrator\Desktop\Graph-WaveNet-master\train.py", line 87, in main
metrics = engine.train(trainx, trainy[:,0,:,:])
File "C:\Users\Administrator\Desktop\Graph-WaveNet-master\engine.py", line 17, in train
output = self.model(input)
File "D:\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\Administrator\Desktop\Graph-WaveNet-master\model.py", line 175, in forward
gate = self.gate_convsi
File "D:\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "D:\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\conv.py", line 307, in forward
return self._conv_forward(input, self.weight, self.bias)
File "D:\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\conv.py", line 303, in _conv_forward
return F.conv1d(input, weight, bias, self.stride,

RuntimeError: Expected 2D (unbatched) or 3D (batched) input to conv1d, but got input of size: [64, 32, 207, 13]

Process finished with exit code 1

@Fei-u
Copy link

Fei-u commented Sep 13, 2022

maybe you have met the same problem with this code issues.
matthias-k/DeepGaze#3
in brief, your torch version>1.11

@Darius-XT
Copy link

have you solve this problem?I‘ve got the same problem as you TT

@Ethan1X
Copy link

Ethan1X commented Feb 13, 2023

Same problem

@StevDL-gif
Copy link
Author

have you solve this problem?I‘ve got the same problem as you TT

Change the python environment to 3.6 and it can run

@Tingthe
Copy link

Tingthe commented Apr 1, 2023

if the torch version>1.11, how can we solve this problem? Who can help me ? Thanks!

@StevDL-gif
Copy link
Author

if the torch version>1.11, how can we solve this problem? Who can help me ? Thanks!

I didn't fix the problem directly from the code change, I downloaded the python 3.6 version from anaconda and configured it, and the problem was solved

@Tingthe
Copy link

Tingthe commented Apr 2, 2023

if the torch version>1.11, how can we solve this problem? Who can help me ? Thanks!

I didn't fix the problem directly from the code change, I downloaded the python 3.6 version from anaconda and configured it, and the problem was solved

Ok,thanks.

@HanWu-Ashley
Copy link

I changed python version to 3.6, torch version to 1.10.2 and it fixed.

@mzshuo
Copy link

mzshuo commented Nov 13, 2023

You can just replace self.gate_convs.append(nn.Conv1d(...)) with self.gate_convs.append(nn.Conv2d(...)) I think.
They should perform the same computation when passing a 2-dimension kernel.
Here is the explanation. #14 (comment)

@yameima
Copy link

yameima commented Mar 20, 2024

I need some help! I changed python version to 3.6, torch version to 1.10.2, but the problem has always existed.
Namespace(device='cpu:3', data='data/METR-LA', adjdata='data/sensor_graph/adj_mx.pkl', adjtype='doubletransition', gcn_bool=True, aptonly=False, addaptadj=True, randomadj=True, seq_len
gth=12, nhid=32, in_dim=2, num_nodes=207, batch_size=64, learning_rate=0.001, dropout=0.3, weight_decay=0.0001, epochs=10, print_every=50, save='./garage/metr', expid=1)
start training...
Traceback (most recent call last):
File "H:\desktop\software\Python Documents\STGCN\train.py", line 198, in
main()
File "H:\desktop\software\Python Documents\STGCN\train.py", line 102, in main
metrics = engine.train(trainx, trainy[:,0,:,:])
File "H:\desktop\software\Python Documents\STGCN\engine.py", line 17, in train
output = self.model(input)
File "C:\Users\dell\AppData\Roaming\Python\Python39\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "C:\Users\dell\AppData\Roaming\Python\Python39\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "H:\desktop\software\Python Documents\STGCN\model.py", line 186, in forward
gate = self.gate_convsi
File "C:\Users\dell\AppData\Roaming\Python\Python39\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "C:\Users\dell\AppData\Roaming\Python\Python39\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "C:\Users\dell\AppData\Roaming\Python\Python39\site-packages\torch\nn\modules\conv.py", line 310, in forward
return self._conv_forward(input, self.weight, self.bias)
File "C:\Users\dell\AppData\Roaming\Python\Python39\site-packages\torch\nn\modules\conv.py", line 306, in _conv_forward
return F.conv1d(input, weight, bias, self.stride,
RuntimeError: Expected 2D (unbatched) or 3D (batched) input to conv1d, but got input of size: [64, 32, 207, 13]

@wdlovecjy
Copy link

我也遇到了相同的问题

@amazon-kddcup24
Copy link

Changing all conv1d to conv2d will solve this issue.

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

10 participants