Skip to content

Commit b291573

Browse files
committed
Make Stateful an iff
1 parent 477cfbd commit b291573

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/torchjd/aggregation/_mixins.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,19 @@
22

33

44
class Stateful(ABC):
5-
"""Mixin adding a reset method."""
5+
r"""
6+
Mixin for stateful mappings.
7+
8+
A maping implements `Stateful` **if and only if** its behavior depends on an internal
9+
state.
10+
11+
Formally, a stateless mapping is a function :math:`f : x \mapsto y` whereas a stateful
12+
maping is a transition map :math:`A : (x, s) \mapsto (y, s')` where :math:`s` is the
13+
internal state, :math:`s'` the updated state, and :math:`y` the output.
14+
There exists an initial state :math:`s_0`, and the method `reset()` restores the state to
15+
:math:`s_0`. A `Stateful` mapping must be constructed with the intial state :math:`s_0`.
16+
"""
617

718
@abstractmethod
819
def reset(self) -> None:
9-
"""Resets the internal state."""
20+
"""Resets the internal state :math:`s_0`."""

0 commit comments

Comments
 (0)