From 9eeca47542b6402475519d5279ab76bca4380746 Mon Sep 17 00:00:00 2001 From: rowan-cake Date: Sat, 7 Mar 2026 11:09:58 -0800 Subject: [PATCH 1/2] null --- src/common/Module.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/common/Module.py b/src/common/Module.py index c1c3464..99c5a6e 100644 --- a/src/common/Module.py +++ b/src/common/Module.py @@ -1,5 +1,5 @@ from abc import ABC, abstractmethod -from typing import Any, Dict, Generator, Union +from typing import Any, Generator from common.autograd import Value @@ -32,10 +32,12 @@ def forward(self, x): .. note:: As per the example above, an ``__init__()`` call to the parent class must be made before assignment on the child.""" + def __init__(self) -> None: - self.params: dict[str, Value | "Module"] = {} # real param store: name -> Value or Module - - + self.params: dict[ + str, Value | "Module" + ] = {} # real param store: name -> Value or Module + @abstractmethod def forward(self, *args: Any, **kwargs: Any) -> Value: """Compute the forward pass for this module.""" @@ -66,7 +68,7 @@ def __setattr__(self, key: str, value: Any) -> None: if isinstance(value, (Value, Module)): self.params[key] = value - def parameters(self) -> Generator[Value,None,None]: + def parameters(self) -> Generator[Value, None, None]: # recursively collects parameters and yields them (use a Generator) for key, param in self.params.items(): if isinstance(param, Module): From 8c15cf9d226a4191d08eadad4747079abfa0b655 Mon Sep 17 00:00:00 2001 From: rowan-cake Date: Sat, 7 Mar 2026 11:18:38 -0800 Subject: [PATCH 2/2] null2 --- src/common/Module.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/Module.py b/src/common/Module.py index 99c5a6e..d2e155f 100644 --- a/src/common/Module.py +++ b/src/common/Module.py @@ -34,9 +34,9 @@ def forward(self, x): must be made before assignment on the child.""" def __init__(self) -> None: - self.params: dict[ - str, Value | "Module" - ] = {} # real param store: name -> Value or Module + self.params: dict[str, Value | "Module"] = ( + {} + ) # real param store: name -> Value or Module @abstractmethod def forward(self, *args: Any, **kwargs: Any) -> Value: