Skip to content

Commit 97c50a0

Browse files
authored
Add size=None explanation to jittable MessagePassing modules (#4850)
* update * changelog * typo
1 parent 6c6e2cc commit 97c50a0

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
55

66
## [2.0.5] - 2022-MM-DD
77
### Added
8+
- Added `size=None` explanation to jittable `MessagePassing` modules in the documentation ([#4850](https://github.com/pyg-team/pytorch_geometric/pull/4850))
89
- Added documentation to the `DataLoaderIterator` class ([#4838](https://github.com/pyg-team/pytorch_geometric/pull/4838))
910
- Added `GraphStore` support to `Data` and `HeteroData` ([#4816](https://github.com/pyg-team/pytorch_geometric/pull/4816))
1011
- Added `FeatureStore` support to `Data` and `HeteroData` ([#4807](https://github.com/pyg-team/pytorch_geometric/pull/4807))

docs/source/notes/jit.rst

+9-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ However, if you want your own GNN module to be jittable, you need to account for
9999
def forward(self, x: Tensor, edge_index: Tensor,
100100
edge_weight: Optional[Tensor]) -> Tensor:
101101
102-
return self.propagate(edge_index, x=x, edge_weight=edge_weight)
102+
return self.propagate(edge_index, x=x, edge_weight=edge_weight,
103+
size=None)
103104
104105
2. Declaring the type of propagation arguments as a comment anywhere inside your module:
105106

@@ -115,4 +116,10 @@ However, if you want your own GNN module to be jittable, you need to account for
115116
edge_weight: Optional[Tensor]) -> Tensor:
116117
117118
# propagate_type: (x: Tensor, edge_weight: Optional[Tensor])
118-
return self.propagate(edge_index, x=x, edge_weight=edge_weight)
119+
return self.propagate(edge_index, x=x, edge_weight=edge_weight,
120+
size=None)
121+
122+
.. warning::
123+
124+
Importantly, due to TorchScript limitations, one also has to pass in the :obj:`size` attribute to :meth:`~torch_geometric.nn.conv.message_passing.MessagePassing.propagate`.
125+
In most cases, this can be simply set to :obj:`None` in which case it will be automatically inferred.

0 commit comments

Comments
 (0)