Skip to content

Commit

Permalink
rebase to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Padarn committed Jul 9, 2022
1 parent cc0eac1 commit fa47205
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions test/nn/aggr/test_equilibrium.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_equilibrium(iter, alpha):
out = model(x)
assert out.size() == (1, 2)

with pytest.raises(NotImplementedError):
with pytest.raises(ValueError):
model(x, dim_size=0)

out = model(x, dim_size=3)
Expand All @@ -45,7 +45,7 @@ def test_equilibrium_batch(iter, alpha):
out = model(x, batch)
assert out.size() == (2, 2)

with pytest.raises(NotImplementedError):
with pytest.raises(ValueError):
model(x, dim_size=0)

out = model(x, dim_size=3)
Expand Down
7 changes: 3 additions & 4 deletions torch_geometric/nn/aggr/equilibrium.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,14 @@ def forward(self, x: Tensor, index: Optional[Tensor] = None, *,
dim: int = -2) -> Tensor:

if ptr is not None:
raise NotImplementedError(
f"{self.__class__} doesn't support `ptr`")
raise ValueError(f"{self.__class__} doesn't support `ptr`")

index_size = 1 if index is None else index.max() + 1
dim_size = index_size if dim_size is None else dim_size

if dim_size < index_size:
raise NotImplementedError("`dim_size` is less than `index` "
"implied size")
raise ValueError("`dim_size` is less than `index` "
"implied size")

with torch.enable_grad():
y = self.optimizer(x, self.init_output(index), index, self.energy,
Expand Down

0 comments on commit fa47205

Please sign in to comment.