Skip to content

Commit fcb9c0f

Browse files
authored
Do not set jinja propagate method in MessagePassing.__init__ twice (#9198)
1 parent 1cb7b04 commit fcb9c0f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

torch_geometric/nn/conv/message_passing.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ def __init__(
240240
self._apply_sigmoid: bool = True
241241

242242
# Inference Decomposition:
243+
self._decomposed_layers = 1
243244
self.decomposed_layers = decomposed_layers
244245

245246
def reset_parameters(self) -> None:
@@ -743,6 +744,9 @@ def decomposed_layers(self, decomposed_layers: int) -> None:
743744
raise ValueError("Inference decomposition of message passing "
744745
"modules is only supported on the Python module")
745746

747+
if decomposed_layers == self._decomposed_layers:
748+
return # Abort early if nothing to do.
749+
746750
self._decomposed_layers = decomposed_layers
747751

748752
if decomposed_layers != 1:
@@ -767,6 +771,9 @@ def explain(self, explain: Optional[bool]) -> None:
767771
raise ValueError("Explainability of message passing modules "
768772
"is only supported on the Python module")
769773

774+
if explain == self._explain:
775+
return # Abort early if nothing to do.
776+
770777
self._explain = explain
771778

772779
if explain is True:

0 commit comments

Comments
 (0)