Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Type Hints]
utils.train_test_split_edges
(#5737)
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>
- Loading branch information