nnzhan / Graph-WaveNet

graph wavenet
MIT License
628 stars 201 forks source link

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

Open StevDL-gif opened 2 years ago

StevDL-gif commented 2 years ago

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 commented 2 years ago

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

Darius-XT commented 1 year ago

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

Ethan1X commented 1 year ago

Same problem

StevDL-gif commented 1 year ago

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 commented 1 year ago

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

StevDL-gif commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

mzshuo commented 1 year ago

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. https://github.com/nnzhan/Graph-WaveNet/issues/14#issuecomment-650068806

yameima commented 8 months ago

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 commented 6 months ago

我也遇到了相同的问题

amazon-kddcup24 commented 4 months ago

Changing all conv1d to conv2d will solve this issue.