I need some help! Expected 2D (unbatched) or 3D (batched) input to conv1d
StevDL-gif opened this issue · comments
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
maybe you have met the same problem with this code issues.
matthias-k/DeepGaze#3
in brief, your torch version>1.11
have you solve this problem?I‘ve got the same problem as you TT
Same problem
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
if the torch version>1.11, how can we solve this problem? Who can help me ? Thanks!
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
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.
I changed python version to 3.6, torch version to 1.10.2 and it fixed.
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)
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]
我也遇到了相同的问题
Changing all conv1d to conv2d will solve this issue.