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

RuntimeError: The expanded size of the tensor (1) must match the existing size (69120) at non-singleton dimension 1. Target sizes: [69120, 1, 64]. Tensor sizes: [1, 69120, 1] #96

Open
imilong opened this issue Apr 24, 2024 · 5 comments

Comments

@imilong
Copy link

imilong commented Apr 24, 2024

Traceback (most recent call last):
File "main.py", line 256, in
main.run()
File "main.py", line 108, in run
self.train_log = train(self.model, model_save_path,
File "/home/pete/PycharmProjects/GDN-main/train.py", line 69, in train
out = model(x, edge_index).float().to(device)
File "/home/pete/anaconda3/envs/mamba/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/pete/anaconda3/envs/mamba/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(args, **kwargs)
File "/home/pete/PycharmProjects/GDN-main/models/GDN.py", line 166, in forward
gcn_out = self.gnn_layers[i](x, batch_gated_edge_index, node_num=node_num
batch_num, embedding=all_embeddings)
File "/home/pete/anaconda3/envs/mamba/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/pete/anaconda3/envs/mamba/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/home/pete/PycharmProjects/GDN-main/models/GDN.py", line 73, in forward
out, (new_edge_index, att_weight) = self.gnn(x, edge_index, embedding, return_attention_weights=True)
File "/home/pete/anaconda3/envs/mamba/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/pete/anaconda3/envs/mamba/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/home/pete/PycharmProjects/GDN-main/models/graph_layer.py", line 65, in forward
out = self.propagate(edge_index, x=x, embedding=embedding, edges=edge_index,
File "/tmp/models.graph_layer_GraphLayer_propagate_ly_wvtvt.py", line 258, in propagate
out = self.aggregate(
File "/home/pete/anaconda3/envs/mamba/lib/python3.8/site-packages/torch_geometric/nn/conv/message_passing.py", line 625, in aggregate
return self.aggr_module(inputs, index, ptr=ptr, dim_size=dim_size,
File "/home/pete/anaconda3/envs/mamba/lib/python3.8/site-packages/torch_geometric/experimental.py", line 117, in wrapper
return func(*args, **kwargs)
File "/home/pete/anaconda3/envs/mamba/lib/python3.8/site-packages/torch_geometric/nn/aggr/base.py", line 136, in call
raise e
File "/home/pete/anaconda3/envs/mamba/lib/python3.8/site-packages/torch_geometric/nn/aggr/base.py", line 128, in call
return super().call(x, index=index, ptr=ptr, dim_size=dim_size,
File "/home/pete/anaconda3/envs/mamba/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/pete/anaconda3/envs/mamba/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/home/pete/anaconda3/envs/mamba/lib/python3.8/site-packages/torch_geometric/nn/aggr/basic.py", line 22, in forward
return self.reduce(x, index, ptr, dim_size, dim, reduce='sum')
File "/home/pete/anaconda3/envs/mamba/lib/python3.8/site-packages/torch_geometric/nn/aggr/base.py", line 182, in reduce
return scatter(x, index, dim, dim_size, reduce)
File "/home/pete/anaconda3/envs/mamba/lib/python3.8/site-packages/torch_geometric/utils/_scatter.py", line 74, in scatter
index = broadcast(index, src, dim)
File "/home/pete/anaconda3/envs/mamba/lib/python3.8/site-packages/torch_geometric/utils/_scatter.py", line 179, in broadcast
return src.view(size).expand_as(ref)
RuntimeError: The expanded size of the tensor (1) must match the existing size (69120) at non-singleton dimension 1. Target sizes: [69120, 1, 64]. Tensor sizes: [1, 69120, 1]

我跑啥数据集都是这个error,该怎么解决?

@ZhouDan1999
Copy link

你好,我也是这个错误,请问你解决了吗

@d-ailin
Copy link
Owner

d-ailin commented May 15, 2024

Hi, this might be related to the mismatched package #6.

@ZhouDan1999
Copy link

Hi, this might be related to the mismatched package #6.

Thanks!

@hepingf100
Copy link

Hi, this might be related to the mismatched package #6.

Thanks!

你好,请问你现在能跑通吗

@iamzhentang
Copy link

I also encountered the same error, may I ask what package does not match? Should I strictly limit the versions of the following package?
Python >= 3.6
cuda == 10.2
Pytorch = = 1.5.1
PyG: torch-geometric==1.5.0

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

5 participants