From bd59790e0819a27e217955bdb45c580b7944778d Mon Sep 17 00:00:00 2001 From: Pierre Chapuis Date: Fri, 1 Sep 2023 15:10:07 +0200 Subject: [PATCH] always respect _can_refresh_parent --- src/refiners/fluxion/layers/chain.py | 2 +- src/refiners/fluxion/layers/module.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/refiners/fluxion/layers/chain.py b/src/refiners/fluxion/layers/chain.py index 6971c4a..cfabe15 100644 --- a/src/refiners/fluxion/layers/chain.py +++ b/src/refiners/fluxion/layers/chain.py @@ -142,7 +142,7 @@ class Chain(ContextModule): self._reset_context() for module in self: - if isinstance(module, ContextModule) and module._can_refresh_parent and module.parent != self: + if isinstance(module, ContextModule) and module.parent != self: module._set_parent(self) @property diff --git a/src/refiners/fluxion/layers/module.py b/src/refiners/fluxion/layers/module.py index edfa423..edf864b 100644 --- a/src/refiners/fluxion/layers/module.py +++ b/src/refiners/fluxion/layers/module.py @@ -62,6 +62,8 @@ class ContextModule(Module): return self._parent[0] def _set_parent(self, parent: "Chain | None") -> None: + if not self._can_refresh_parent: + return if parent is None: self._parent = [] return