-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Type Hints] utils.train_test_split_edges
#5737
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shhs29
changed the title
Add type hints for train_test_split_edges
[Type Hints] Oct 16, 2022
utils.train_test_split_edges
rusty1s
approved these changes
Oct 17, 2022
rusty1s
approved these changes
Oct 17, 2022
Codecov Report
@@ Coverage Diff @@
## master #5737 +/- ##
=======================================
Coverage 84.04% 84.04%
=======================================
Files 349 349
Lines 19318 19320 +2
=======================================
+ Hits 16236 16238 +2
Misses 3082 3082
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
JakubPietrakIntel
pushed a commit
to JakubPietrakIntel/pytorch_geometric
that referenced
this pull request
Nov 25, 2022
I have a question regarding jit script support for utils.train_test_split_edges. I am getting an issue related to circular imports. My full test is also failing on local (Removing this as TorchScript does not support Data). I would appreciate it if anyone has any suggestions to fix this issue. ``` Traceback (most recent call last): File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages/sphinx/config.py", line 347, in eval_config_file exec(code, namespace) File "/home/runner/work/pytorch_geometric/pytorch_geometric/docs/source/conf.py", line 3, in <module> import torch_geometric File "/home/runner/work/pytorch_geometric/pytorch_geometric/torch_geometric/__init__.py", line 4, in <module> import torch_geometric.data File "/home/runner/work/pytorch_geometric/pytorch_geometric/torch_geometric/data/__init__.py", line 1, in <module> from .data import Data File "/home/runner/work/pytorch_geometric/pytorch_geometric/torch_geometric/data/data.py", line 22, in <module> from torch_geometric.data.feature_store import ( File "/home/runner/work/pytorch_geometric/pytorch_geometric/torch_geometric/data/feature_store.py", line 33, in <module> from torch_geometric.utils.mixin import CastMixin File "/home/runner/work/pytorch_geometric/pytorch_geometric/torch_geometric/utils/__init__.py", line 37, in <module> from .train_test_split_edges import train_test_split_edges File "/home/runner/work/pytorch_geometric/pytorch_geometric/torch_geometric/utils/train_test_split_edges.py", line 6, in <module> from torch_geometric.data import Data ImportError: cannot import name 'Data' from partially initialized module 'torch_geometric.data' (most likely due to a circular import) (/home/runner/work/pytorch_geometric/pytorch_geometric/torch_geometric/data/__init__.py) ``` ``` RuntimeError: E Arguments for call are not valid. E The following variants are available: E E aten::__contains__.int_list(int[] l, int item) -> (bool): E Expected a value of type 'List[int]' for argument 'l' but instead found type 'Tensor (inferred)'. E Inferred the value for argument 'l' to be of type 'Tensor' because it was not annotated with an explicit type. E E aten::__contains__.str_list(str[] l, str item) -> (bool): E Expected a value of type 'List[str]' for argument 'l' but instead found type 'Tensor (inferred)'. E Inferred the value for argument 'l' to be of type 'Tensor' because it was not annotated with an explicit type. E E aten::__contains__.str(Dict(str, t) dict, str key) -> (bool): E Could not match type Tensor (inferred) to Dict[str, t] in argument 'dict': Cannot match a dict to Tensor (inferred). E E aten::__contains__.int(Dict(int, t) dict, int key) -> (bool): E Could not match type Tensor (inferred) to Dict[int, t] in argument 'dict': Cannot match a dict to Tensor (inferred). E E aten::__contains__.bool(Dict(bool, t) dict, bool key) -> (bool): E Could not match type Tensor (inferred) to Dict[bool, t] in argument 'dict': Cannot match a dict to Tensor (inferred). E E aten::__contains__.float(Dict(float, t) dict, float key) -> (bool): E Could not match type Tensor (inferred) to Dict[float, t] in argument 'dict': Cannot match a dict to Tensor (inferred). E E aten::__contains__.complex(Dict(complex, t) dict, complex key) -> (bool): E Could not match type Tensor (inferred) to Dict[complex, t] in argument 'dict': Cannot match a dict to Tensor (inferred). E E aten::__contains__.Tensor(Dict(Tensor, t) dict, Tensor key) -> (bool): E Could not match type Tensor (inferred) to Dict[Tensor, t] in argument 'dict': Cannot match a dict to Tensor (inferred). E E aten::__contains__.float_list(float[] l, float item) -> (bool): E Expected a value of type 'List[float]' for argument 'l' but instead found type 'Tensor (inferred)'. E Inferred the value for argument 'l' to be of type 'Tensor' because it was not annotated with an explicit type. E E __contains__(str self, str key) -> (bool): E Expected a value of type 'str' for argument 'self' but instead found type 'Tensor (inferred)'. E Inferred the value for argument 'self' to be of type 'Tensor' because it was not annotated with an explicit type. E E The original call is: E File "/Users/shwetajacob/Documents/pyg/pytorch_geometric/torch_geometric/deprecation.py", line 38 E """ E E assert 'batch' not in data # No batch-mode. E ~~~~~~~~~~~~~~~~~~~ <--- HERE E E num_nodes = data.num_nodes /opt/homebrew/Caskroom/miniforge/base/envs/pyg_dev/lib/python3.9/site-packages/torch/jit/_script.py:1343: RuntimeError ``` Co-authored-by: rusty1s <matthias.fey@tu-dortmund.de>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have a question regarding jit script support for utils.train_test_split_edges. I am getting an issue related to circular imports. My full test is also failing on local (Removing this as TorchScript does not support Data). I would appreciate it if anyone has any suggestions to fix this issue.