Skip to content

Commit

Permalink
Fix MLP.jittable() bug in case return_emb=True (#4645)
Browse files Browse the repository at this point in the history
* fix MLP

* changelog
  • Loading branch information
rusty1s authored May 15, 2022
1 parent cfaea95 commit c20f8df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added support for graph-level outputs in `to_hetero` ([#4582](https://github.com/pyg-team/pytorch_geometric/pull/4582))
- Added `CHANGELOG.md` ([#4581](https://github.com/pyg-team/pytorch_geometric/pull/4581))
### Changed
- Fixed `MLP.jittable()` bug in case `return_emb=True` ([#4645](https://github.com/pyg-team/pytorch_geometric/pull/4645))
- The generated node features of `StochasticBlockModelDataset` are now ordered with respect to their labels ([#4617](https://github.com/pyg-team/pytorch_geometric/pull/4617))
- Removed unnecessary colons and fixed typos in the documentation ([#4616](https://github.com/pyg-team/pytorch_geometric/pull/4616))
- The `bias` argument in `TAGConv` is now actually applied ([#4597](https://github.com/pyg-team/pytorch_geometric/pull/4597))
Expand Down
4 changes: 2 additions & 2 deletions torch_geometric/nn/models/mlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def reset_parameters(self):
if hasattr(norm, 'reset_parameters'):
norm.reset_parameters()

def forward(self, x: Tensor, return_emb: bool = False) -> Tensor:
def forward(self, x: Tensor, return_emb=None) -> Tensor:
""""""
x = self.lins[0](x)
emb = x
Expand All @@ -151,7 +151,7 @@ def forward(self, x: Tensor, return_emb: bool = False) -> Tensor:
x = F.dropout(x, p=self.dropout, training=self.training)
x = lin.forward(x)

return (x, emb) if return_emb else x
return (x, emb) if isinstance(return_emb, bool) else x

def __repr__(self) -> str:
return f'{self.__class__.__name__}({str(self.channel_list)[1:-1]})'

0 comments on commit c20f8df

Please sign in to comment.