Coder Social home page Coder Social logo

Comments (8)

cszhangzhen avatar cszhangzhen commented on May 26, 2024

Hi,

It works well on my server. It may be caused by the version of torch-sparse. My current version is 0.6.15.

from hgp-sl.

lig97 avatar lig97 commented on May 26, 2024

Hi, I just took a look at my torch-sparse version, it is the same as your version, but the problem is still not solved, and an error will still appear.

I am new to the graph convolutional neural network. Can you tell me why the code did not report an error at the beginning, but an error occurred at the 24th epoch? I ran the code many times and found that the epoch of the error is not fixed and will change. Looking forward to your answer, thank you !!

from hgp-sl.

cszhangzhen avatar cszhangzhen commented on May 26, 2024

Hi, I can not reproduce your error on my server. Could you provide more information? Which dataset are you using? What are the hyper-parameters?

My current environments:
pytorch 1.13.1
torch_geometric 2.2.0
torch_sparse 0.6.15
torch_scatter 2.1.0
torch_cluster 1.6.0

from hgp-sl.

lig97 avatar lig97 commented on May 26, 2024

Hello, thank you for your previous answers. Those problems may be due to the configuration of my computer, and they have been resolved.
However, I have another problem, I try to run the model with my dataset. When the edge feature of the dataset is one-dimensional, the model does not go wrong. But when the edge feature of the data set is multi-dimensional, the system reports an error. What is the reason? I found in your article that you also used some data with multi-dimensional edge features and achieved good accuracy. For my situation, how can I solve it?
I have changed edge_attr = None in the model forward function to edge_attr = data.edge_attr
The model error results are as follows:

Traceback (most recent call last):
File "C:\Users\asus\Desktop\python\pythonProject\main.py", line 133, in
best_model = train()
File "C:\Users\asus\Desktop\python\pythonProject\main.py", line 77, in train
out = model(data)
File "D:\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\asus\Desktop\python\pythonProject\models.py", line 38, in forward
x = F.relu(self.conv1(x, edge_index, edge_attr))
File "D:\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "D:\Anaconda3\lib\site-packages\torch_geometric\nn\conv\gcn_conv.py", line 199, in forward
size=None)
File "D:\Anaconda3\lib\site-packages\torch_geometric\nn\conv\message_passing.py", line 437, in propagate
out = self.message(**msg_kwargs)
File "D:\Anaconda3\lib\site-packages\torch_geometric\nn\conv\gcn_conv.py", line 207, in message
return x_j if edge_weight is None else edge_weight.view(-1, 1) * x_j
RuntimeError: The size of tensor a (814096) must match the size of tensor b (203524) at non-singleton dimension 0

It is obvious that the dimensions do not match, where a is 4 times that of b, and my side multi-dimensional features are also 4-dimensional. How can I solve this situation? Thanks again for your answer and look forward to your reply.

from hgp-sl.

cszhangzhen avatar cszhangzhen commented on May 26, 2024

Hi,

We do not use any edge feature in our paper.

Using edge features may result in errors. This is predictable. The model could learn a new edge in the pooled graph that does not exist in the original graph. You need to use additional codes to handle this situation.

from hgp-sl.

lig97 avatar lig97 commented on May 26, 2024

thank you for your reply!
You said that no edge features are used, does that mean that one-dimensional edge features are not used? Even if I change edge_attr = None to edge_attr = edge_attr = data.edge_attr, the model will not use the edge features in my dataset?
Looking forward to your reply, thank you.

from hgp-sl.

cszhangzhen avatar cszhangzhen commented on May 26, 2024

Hi,

I mean we do not use the edge features in the original dataset (if they have edge features).

Actually, we learn the edge weights to re-connect nodes in the pooled graph. Thus, the edge_attr in the codes actually means edge_weight. This is the reason why it only works for one-dimensional edge features.

If you want it to support multi-dimensional edge features, you need to revise the code on the structure learning part. One natural question is how to initialize new edge's edge features. When calculating edge weights, you also need to take edge features into consideration in the attention mechanism.

from hgp-sl.

lig97 avatar lig97 commented on May 26, 2024

ok, i see, thanks for your reply!

from hgp-sl.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.