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

Expected a value of type 'Optional[Tensor]' for argument 'ptr' but instead found type 'int'. #20

Closed
Scienceseb opened this issue Mar 23, 2022 · 2 comments

Comments

@Scienceseb
Copy link

Hello I get the same error:

RuntimeError: softmax() Expected a value of type 'Optional[Tensor]' for argument 'ptr' but instead found type 'int'.
Position: 2
Value: 48
Declaration: softmax(Tensor src, Tensor? index=None, Tensor? ptr=None, int? num_nodes=None, int dim=0) -> (Tensor)
Cast error details: Unable to cast Python instance to C++ type (compile in debug mode for details)

Why the code cannot work with my environment ? It is the first time I ever encounter that type of error... I have CUDA 11.3 and PyTorch 1.10.2.

Thanks for your help !

Originally posted by @Scienceseb in #10 (comment)

@d-ailin
Copy link
Owner

d-ailin commented Mar 25, 2022

I think the best way is to run the code with a virtual environment with same environmental setting (package' version) provided in the repo.

Also, you could refer to some previous issue #2. It seems it could work out by modifying some code (but I am not quite sure about the effect).

@Scienceseb
Copy link
Author

The fix is the following:

In graph_layer.py

self.node_dim=0
alpha = softmax(alpha, edge_index_i, num_nodes=size_i)

  1. Error with dataloader: https://stackoverflow.com/questions/70193443/colab-notebook-cannot-import-name-container-abcs-from-torch-six

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

2 participants