nshutils 0.22.4__tar.gz → 0.22.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nshutils-0.22.4 → nshutils-0.22.5}/PKG-INFO +1 -1
- {nshutils-0.22.4 → nshutils-0.22.5}/pyproject.toml +1 -1
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/actsave/_saver.py +5 -5
- {nshutils-0.22.4 → nshutils-0.22.5}/README.md +0 -0
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/__init__.py +0 -0
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/__init__.pyi +0 -0
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/actsave/__init__.py +0 -0
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/actsave/_loader.py +0 -0
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/collections.py +0 -0
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/display.py +0 -0
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/logging.py +0 -0
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/lovely/__init__.py +0 -0
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/lovely/_base.py +0 -0
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/lovely/_monkey_patch_all.py +0 -0
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/lovely/config.py +0 -0
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/lovely/jax_.py +0 -0
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/lovely/numpy_.py +0 -0
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/lovely/torch_.py +0 -0
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/lovely/utils.py +0 -0
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/snoop.py +0 -0
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/typecheck.py +0 -0
- {nshutils-0.22.4 → nshutils-0.22.5}/src/nshutils/util.py +0 -0
@@ -9,7 +9,7 @@ from dataclasses import dataclass
|
|
9
9
|
from functools import wraps
|
10
10
|
from logging import getLogger
|
11
11
|
from pathlib import Path
|
12
|
-
from typing import TYPE_CHECKING, Generic, Literal, Union, cast, overload
|
12
|
+
from typing import TYPE_CHECKING, Any, Generic, Literal, Union, cast, overload
|
13
13
|
|
14
14
|
import numpy as np
|
15
15
|
from typing_extensions import Never, ParamSpec, TypeAliasType, TypeVar, override
|
@@ -36,8 +36,9 @@ else:
|
|
36
36
|
|
37
37
|
log = getLogger(__name__)
|
38
38
|
|
39
|
+
# Updated to include Any for arbitrary types
|
39
40
|
Value = TypeAliasType(
|
40
|
-
"Value", Union[int, float, complex, bool, str, np.ndarray, Tensor, None]
|
41
|
+
"Value", Union[int, float, complex, bool, str, np.ndarray, Tensor, Any, None]
|
41
42
|
)
|
42
43
|
ValueOrLambda = TypeAliasType("ValueOrLambda", Union[Value, Callable[..., Value]])
|
43
44
|
|
@@ -65,9 +66,8 @@ def _to_numpy(activation: Value) -> np.ndarray:
|
|
65
66
|
activation_ = activation_.float()
|
66
67
|
return activation_.cpu().numpy()
|
67
68
|
else:
|
68
|
-
|
69
|
-
|
70
|
-
return activation
|
69
|
+
# Handle arbitrary objects using numpy object dtype
|
70
|
+
return np.array(activation, dtype=object)
|
71
71
|
|
72
72
|
|
73
73
|
T = TypeVar("T", infer_variance=True)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|