Skip to content

Commit

Permalink
Add proper error messages in __check_input__() (#5042)
Browse files Browse the repository at this point in the history
* Add proper error messages in `__check_input__()`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Format update to pass linting error

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
modanesh and pre-commit-ci[bot] authored Jul 24, 2022
1 parent 6ed5caf commit 575611f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions torch_geometric/nn/conv/message_passing.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,12 @@ def __check_input__(self, edge_index, size):
the_size: List[Optional[int]] = [None, None]

if isinstance(edge_index, Tensor):
assert edge_index.dtype == torch.long
assert edge_index.dim() == 2
assert edge_index.size(0) == 2
assert edge_index.dtype == torch.long, \
"edge_index.dtype is not of torch.long"
assert edge_index.dim() == 2, \
"edge_index.dim() is not equal to 2"
assert edge_index.size(0) == 2, \
"edge_index.size(0) is not equal to 2"
if size is not None:
the_size[0] = size[0]
the_size[1] = size[1]
Expand Down

0 comments on commit 575611f

Please sign in to comment.