-
QuestionI am trying out the example of HIN using MUTAG dataset but run into this error: Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3418, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-96b1080fe156>", line 1, in <module>
runfile('/Users/gori/Google Drive/heter-master/pytorch_geometric_hetero/hin_mutag.py', wdir='/Users/gori/Google Drive/heter-master/pytorch_geometric_hetero')
File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_umd.py", line 198, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/gori/Google Drive/heter-master/pytorch_geometric_hetero/hin_mutag.py", line 91, in <module>
loss = train()
File "/Users/gori/Google Drive/heter-master/pytorch_geometric_hetero/hin_mutag.py", line 70, in train
out = model(data.x, data.edge_index, data.batch)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/Users/gori/Google Drive/heter-master/pytorch_geometric_hetero/hin_mutag.py", line 53, in forward
x = conv(x, edge_index).relu()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/torch_geometric/nn/conv/gin_conv.py", line 70, in forward
return self.nn(out)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/torch_geometric/nn/models/mlp.py", line 56, in forward
x = norm(x)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/torch/nn/modules/batchnorm.py", line 135, in forward
return F.batch_norm(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/torch/nn/functional.py", line 2146, in batch_norm
return torch.batch_norm(
RuntimeError: weight should contain 32 elements not 1 Environment
I suspect it is caused by inconsistent version of PyG and other libs too perhaps, but I can't upgrade them at the moment for avoiding affecting project works that are done already. Can anyone help on solving this issue without upgrading libraries? A billion thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I think it is best to always use the examples of the respective version that you use, e.g., https://github.com/pyg-team/pytorch_geometric/blob/2.0.2/examples/mutag_gin.py. Can you confirm that running this example works for you? |
Beta Was this translation helpful? Give feedback.
I think it is best to always use the examples of the respective version that you use, e.g., https://github.com/pyg-team/pytorch_geometric/blob/2.0.2/examples/mutag_gin.py. Can you confirm that running this example works for you?