optax 0.2.4__tar.gz → 0.2.6__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.
- {optax-0.2.4 → optax-0.2.6}/PKG-INFO +7 -21
- {optax-0.2.4 → optax-0.2.6}/optax/__init__.py +74 -60
- {optax-0.2.4 → optax-0.2.6}/optax/_src/alias.py +311 -111
- {optax-0.2.4 → optax-0.2.6}/optax/_src/alias_test.py +323 -106
- {optax-0.2.4 → optax-0.2.6}/optax/_src/base.py +8 -5
- {optax-0.2.4 → optax-0.2.6}/optax/_src/combine.py +2 -1
- {optax-0.2.4 → optax-0.2.6}/optax/_src/combine_test.py +7 -7
- {optax-0.2.4 → optax-0.2.6}/optax/_src/deprecations.py +1 -3
- {optax-0.2.4 → optax-0.2.6}/optax/_src/factorized.py +6 -7
- {optax-0.2.4 → optax-0.2.6}/optax/_src/float64_test.py +17 -17
- {optax-0.2.4 → optax-0.2.6}/optax/_src/linear_algebra.py +94 -10
- {optax-0.2.4 → optax-0.2.6}/optax/_src/linear_algebra_test.py +46 -11
- {optax-0.2.4 → optax-0.2.6}/optax/_src/linesearch.py +54 -44
- {optax-0.2.4 → optax-0.2.6}/optax/_src/linesearch_test.py +199 -158
- {optax-0.2.4 → optax-0.2.6}/optax/_src/lookahead_test.py +3 -3
- {optax-0.2.4 → optax-0.2.6}/optax/_src/numerics_test.py +35 -24
- {optax-0.2.4 → optax-0.2.6}/optax/_src/transform.py +163 -137
- {optax-0.2.4 → optax-0.2.6}/optax/_src/transform_test.py +3 -3
- {optax-0.2.4 → optax-0.2.6}/optax/_src/update_test.py +5 -5
- {optax-0.2.4 → optax-0.2.6}/optax/_src/utils.py +48 -15
- {optax-0.2.4 → optax-0.2.6}/optax/_src/utils_test.py +2 -2
- {optax-0.2.4 → optax-0.2.6}/optax/_src/wrappers.py +0 -22
- {optax-0.2.4 → optax-0.2.6}/optax/assignment/__init__.py +1 -0
- {optax-0.2.4 → optax-0.2.6}/optax/assignment/_hungarian_algorithm.py +179 -1
- {optax-0.2.4 → optax-0.2.6}/optax/assignment/_hungarian_algorithm_test.py +12 -7
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/__init__.py +16 -0
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/_acprop.py +7 -6
- optax-0.2.6/optax/contrib/_ademamix.py +461 -0
- optax-0.2.6/optax/contrib/_adopt.py +176 -0
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/_cocob.py +4 -4
- optax-0.2.6/optax/contrib/_common_test.py +550 -0
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/_complex_valued_test.py +4 -3
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/_dadapt_adamw.py +12 -9
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/_dog.py +78 -72
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/_mechanic.py +14 -10
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/_mechanic_test.py +2 -2
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/_momo.py +18 -16
- optax-0.2.6/optax/contrib/_muon.py +455 -0
- optax-0.2.6/optax/contrib/_muon_test.py +235 -0
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/_privacy.py +39 -8
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/_privacy_test.py +4 -4
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/_prodigy.py +12 -9
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/_reduce_on_plateau.py +4 -4
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/_sam.py +3 -4
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/_sam_test.py +6 -6
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/_schedule_free.py +4 -4
- optax-0.2.6/optax/contrib/_sophia.py +316 -0
- {optax-0.2.4 → optax-0.2.6}/optax/losses/__init__.py +7 -1
- {optax-0.2.4 → optax-0.2.6}/optax/losses/_classification.py +140 -43
- {optax-0.2.4 → optax-0.2.6}/optax/losses/_classification_test.py +229 -127
- {optax-0.2.4 → optax-0.2.6}/optax/losses/_fenchel_young_test.py +1 -1
- {optax-0.2.4 → optax-0.2.6}/optax/losses/_ranking_test.py +0 -2
- {optax-0.2.4 → optax-0.2.6}/optax/losses/_regression_test.py +5 -5
- optax-0.2.6/optax/losses/_segmentation.py +260 -0
- optax-0.2.6/optax/losses/_segmentation_test.py +494 -0
- {optax-0.2.4 → optax-0.2.6}/optax/losses/_self_supervised.py +66 -12
- optax-0.2.6/optax/losses/_self_supervised_test.py +133 -0
- {optax-0.2.4 → optax-0.2.6}/optax/monte_carlo/__init__.py +4 -2
- {optax-0.2.4 → optax-0.2.6}/optax/monte_carlo/control_variates.py +6 -6
- {optax-0.2.4 → optax-0.2.6}/optax/monte_carlo/stochastic_gradient_estimators.py +9 -9
- {optax-0.2.4 → optax-0.2.6}/optax/perturbations/__init__.py +0 -1
- optax-0.2.6/optax/perturbations/_make_pert.py +174 -0
- optax-0.2.6/optax/perturbations/_make_pert_test.py +284 -0
- {optax-0.2.4 → optax-0.2.6}/optax/projections/__init__.py +3 -0
- {optax-0.2.4 → optax-0.2.6}/optax/projections/_projections.py +120 -63
- {optax-0.2.4 → optax-0.2.6}/optax/projections/_projections_test.py +70 -10
- {optax-0.2.4 → optax-0.2.6}/optax/schedules/_inject.py +2 -1
- {optax-0.2.4 → optax-0.2.6}/optax/schedules/_inject_test.py +45 -5
- {optax-0.2.4 → optax-0.2.6}/optax/schedules/_schedule.py +65 -24
- {optax-0.2.4 → optax-0.2.6}/optax/schedules/_schedule_test.py +66 -9
- {optax-0.2.4 → optax-0.2.6}/optax/second_order/_hessian_test.py +1 -1
- {optax-0.2.4 → optax-0.2.6}/optax/transforms/__init__.py +8 -1
- {optax-0.2.4 → optax-0.2.6}/optax/transforms/_accumulation.py +27 -20
- {optax-0.2.4 → optax-0.2.6}/optax/transforms/_accumulation_test.py +17 -19
- {optax-0.2.4 → optax-0.2.6}/optax/transforms/_adding.py +70 -13
- {optax-0.2.4 → optax-0.2.6}/optax/transforms/_adding_test.py +21 -21
- {optax-0.2.4 → optax-0.2.6}/optax/transforms/_clipping.py +49 -15
- {optax-0.2.4 → optax-0.2.6}/optax/transforms/_clipping_test.py +123 -15
- {optax-0.2.4 → optax-0.2.6}/optax/transforms/_combining.py +43 -22
- {optax-0.2.4 → optax-0.2.6}/optax/transforms/_conditionality.py +3 -3
- optax-0.2.6/optax/transforms/_freezing.py +107 -0
- optax-0.2.6/optax/transforms/_freezing_test.py +346 -0
- {optax-0.2.4 → optax-0.2.6}/optax/transforms/_masking_test.py +7 -7
- optax-0.2.6/optax/transforms/_monitoring.py +80 -0
- optax-0.2.6/optax/transforms/_monitoring_test.py +61 -0
- optax-0.2.6/optax/tree/__init__.py +58 -0
- optax-0.2.6/optax/tree_utils/__init__.py +107 -0
- {optax-0.2.4 → optax-0.2.6}/optax/tree_utils/_casting.py +41 -16
- {optax-0.2.4 → optax-0.2.6}/optax/tree_utils/_casting_test.py +21 -4
- {optax-0.2.4 → optax-0.2.6}/optax/tree_utils/_random.py +32 -5
- {optax-0.2.4 → optax-0.2.6}/optax/tree_utils/_random_test.py +10 -8
- {optax-0.2.4 → optax-0.2.6}/optax/tree_utils/_state_utils.py +52 -67
- {optax-0.2.4 → optax-0.2.6}/optax/tree_utils/_state_utils_test.py +62 -34
- {optax-0.2.4 → optax-0.2.6}/optax/tree_utils/_tree_math.py +118 -40
- {optax-0.2.4 → optax-0.2.6}/optax/tree_utils/_tree_math_test.py +86 -38
- {optax-0.2.4 → optax-0.2.6}/pyproject.toml +68 -23
- optax-0.2.4/optax/contrib/_common_test.py +0 -358
- optax-0.2.4/optax/losses/_self_supervised_test.py +0 -70
- optax-0.2.4/optax/monte_carlo/control_variates_test.py +0 -751
- optax-0.2.4/optax/monte_carlo/stochastic_gradient_estimators_test.py +0 -428
- optax-0.2.4/optax/perturbations/_make_pert.py +0 -195
- optax-0.2.4/optax/perturbations/_make_pert_test.py +0 -168
- optax-0.2.4/optax/tree_utils/__init__.py +0 -48
- {optax-0.2.4 → optax-0.2.6}/LICENSE +0 -0
- {optax-0.2.4 → optax-0.2.6}/README.md +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/_src/base_test.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/_src/clipping.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/_src/constrain.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/_src/factorized_test.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/_src/lookahead.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/_src/numerics.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/_src/schedule.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/_src/update.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/_complex_valued.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/_reduce_on_plateau_test.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/contrib/_schedule_free_test.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/losses/_fenchel_young.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/losses/_ranking.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/losses/_regression.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/losses/_smoothing.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/losses/_smoothing_test.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/optax_test.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/schedules/__init__.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/schedules/_join.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/schedules/_join_test.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/schedules/inject.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/second_order/__init__.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/second_order/_base.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/second_order/_fisher.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/second_order/_hessian.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/transforms/_combining_test.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/transforms/_conditionality_test.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/transforms/_constraining.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/transforms/_constraining_test.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/transforms/_layouts.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/transforms/_layouts_test.py +0 -0
- {optax-0.2.4 → optax-0.2.6}/optax/transforms/_masking.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: optax
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.6
|
|
4
4
|
Summary: A gradient processing and optimization library in JAX.
|
|
5
5
|
Keywords: python,machine learning,reinforcement-learning
|
|
6
6
|
Author-email: Google DeepMind <optax-dev@google.com>
|
|
7
|
-
Requires-Python: >=3.
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
9
|
Classifier: Environment :: Console
|
|
10
10
|
Classifier: Programming Language :: Python
|
|
@@ -16,12 +16,12 @@ Classifier: Development Status :: 4 - Beta
|
|
|
16
16
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
17
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
18
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
License-File: LICENSE
|
|
19
20
|
Requires-Dist: absl-py>=0.7.1
|
|
20
21
|
Requires-Dist: chex>=0.1.87
|
|
21
|
-
Requires-Dist: jax>=0.
|
|
22
|
-
Requires-Dist: jaxlib>=0.
|
|
22
|
+
Requires-Dist: jax>=0.5.3
|
|
23
|
+
Requires-Dist: jaxlib>=0.5.3
|
|
23
24
|
Requires-Dist: numpy>=1.18.0
|
|
24
|
-
Requires-Dist: etils[epy]
|
|
25
25
|
Requires-Dist: sphinx>=6.0.0 ; extra == "docs"
|
|
26
26
|
Requires-Dist: sphinx-book-theme>=1.0.1 ; extra == "docs"
|
|
27
27
|
Requires-Dist: sphinxcontrib-katex ; extra == "docs"
|
|
@@ -31,21 +31,9 @@ Requires-Dist: myst-nb>=1.0.0 ; extra == "docs"
|
|
|
31
31
|
Requires-Dist: matplotlib>=3.5.0 ; extra == "docs"
|
|
32
32
|
Requires-Dist: sphinx-gallery>=0.14.0 ; extra == "docs"
|
|
33
33
|
Requires-Dist: sphinx-collections>=0.0.1 ; extra == "docs"
|
|
34
|
-
Requires-Dist: tensorflow>=2.4.0 ; extra == "docs"
|
|
35
|
-
Requires-Dist: tensorflow-datasets>=4.2.0 ; extra == "docs"
|
|
36
34
|
Requires-Dist: flax ; extra == "docs"
|
|
37
35
|
Requires-Dist: sphinx_contributors ; extra == "docs"
|
|
38
|
-
Requires-Dist:
|
|
39
|
-
Requires-Dist: attrs>=21.4.0 ; extra == "dp-accounting"
|
|
40
|
-
Requires-Dist: mpmath>=1.2.1 ; extra == "dp-accounting"
|
|
41
|
-
Requires-Dist: numpy>=1.21.4 ; extra == "dp-accounting"
|
|
42
|
-
Requires-Dist: scipy>=1.7.1 ; extra == "dp-accounting"
|
|
43
|
-
Requires-Dist: tensorflow-datasets>=4.2.0 ; extra == "examples"
|
|
44
|
-
Requires-Dist: tensorflow>=2.4.0 ; extra == "examples"
|
|
45
|
-
Requires-Dist: dp_accounting>=0.4 ; extra == "examples"
|
|
46
|
-
Requires-Dist: ipywidgets ; extra == "examples"
|
|
47
|
-
Requires-Dist: flax ; extra == "examples"
|
|
48
|
-
Requires-Dist: dm-tree>=0.1.7 ; extra == "test"
|
|
36
|
+
Requires-Dist: setuptools ; extra == "docs"
|
|
49
37
|
Requires-Dist: flax>=0.5.3 ; extra == "test"
|
|
50
38
|
Requires-Dist: scipy>=1.7.1 ; extra == "test"
|
|
51
39
|
Requires-Dist: scikit-learn ; extra == "test"
|
|
@@ -53,8 +41,6 @@ Project-URL: documentation, https://optax.readthedocs.io/
|
|
|
53
41
|
Project-URL: homepage, https://github.com/google-deepmind/optax
|
|
54
42
|
Project-URL: repository, https://github.com/google-deepmind/optax
|
|
55
43
|
Provides-Extra: docs
|
|
56
|
-
Provides-Extra: dp-accounting
|
|
57
|
-
Provides-Extra: examples
|
|
58
44
|
Provides-Extra: test
|
|
59
45
|
|
|
60
46
|
# Optax
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
# pylint: disable=wrong-import-position
|
|
18
18
|
# pylint: disable=g-importing-member
|
|
19
19
|
|
|
20
|
+
import typing as _typing
|
|
21
|
+
|
|
20
22
|
from optax import assignment
|
|
21
23
|
from optax import contrib
|
|
22
24
|
from optax import losses
|
|
@@ -26,6 +28,7 @@ from optax import projections
|
|
|
26
28
|
from optax import schedules
|
|
27
29
|
from optax import second_order
|
|
28
30
|
from optax import transforms
|
|
31
|
+
from optax import tree
|
|
29
32
|
from optax import tree_utils
|
|
30
33
|
from optax._src.alias import adabelief
|
|
31
34
|
from optax._src.alias import adadelta
|
|
@@ -48,6 +51,7 @@ from optax._src.alias import nadamw
|
|
|
48
51
|
from optax._src.alias import noisy_sgd
|
|
49
52
|
from optax._src.alias import novograd
|
|
50
53
|
from optax._src.alias import optimistic_adam
|
|
54
|
+
from optax._src.alias import optimistic_adam_v2
|
|
51
55
|
from optax._src.alias import optimistic_gradient_descent
|
|
52
56
|
from optax._src.alias import polyak_sgd
|
|
53
57
|
from optax._src.alias import radam
|
|
@@ -61,6 +65,7 @@ from optax._src.base import EmptyState
|
|
|
61
65
|
from optax._src.base import GradientTransformation
|
|
62
66
|
from optax._src.base import GradientTransformationExtraArgs
|
|
63
67
|
from optax._src.base import identity
|
|
68
|
+
from optax._src.base import init_empty_state
|
|
64
69
|
from optax._src.base import OptState
|
|
65
70
|
from optax._src.base import Params
|
|
66
71
|
from optax._src.base import ScalarOrSchedule
|
|
@@ -73,27 +78,11 @@ from optax._src.base import TransformUpdateExtraArgsFn
|
|
|
73
78
|
from optax._src.base import TransformUpdateFn
|
|
74
79
|
from optax._src.base import Updates
|
|
75
80
|
from optax._src.base import with_extra_args_support
|
|
76
|
-
from optax._src.clipping import adaptive_grad_clip
|
|
77
|
-
from optax._src.clipping import AdaptiveGradClipState
|
|
78
|
-
from optax._src.clipping import clip
|
|
79
|
-
from optax._src.clipping import clip_by_block_rms
|
|
80
|
-
from optax._src.clipping import clip_by_global_norm
|
|
81
|
-
from optax._src.clipping import ClipByGlobalNormState
|
|
82
|
-
from optax._src.clipping import ClipState
|
|
83
|
-
from optax._src.clipping import per_example_global_norm_clip
|
|
84
|
-
from optax._src.clipping import per_example_layer_norm_clip
|
|
85
|
-
from optax._src.combine import chain
|
|
86
|
-
from optax._src.combine import multi_transform
|
|
87
|
-
from optax._src.combine import MultiTransformState
|
|
88
|
-
from optax._src.combine import named_chain
|
|
89
|
-
from optax._src.constrain import keep_params_nonnegative
|
|
90
|
-
from optax._src.constrain import NonNegativeParamsState
|
|
91
|
-
from optax._src.constrain import zero_nans
|
|
92
|
-
from optax._src.constrain import ZeroNansState
|
|
93
81
|
from optax._src.factorized import FactoredState
|
|
94
82
|
from optax._src.factorized import scale_by_factored_rms
|
|
95
83
|
from optax._src.linear_algebra import global_norm
|
|
96
84
|
from optax._src.linear_algebra import matrix_inverse_pth_root
|
|
85
|
+
from optax._src.linear_algebra import nnls
|
|
97
86
|
from optax._src.linear_algebra import power_iteration
|
|
98
87
|
from optax._src.linesearch import scale_by_backtracking_linesearch
|
|
99
88
|
from optax._src.linesearch import scale_by_zoom_linesearch
|
|
@@ -107,15 +96,9 @@ from optax._src.numerics import safe_increment
|
|
|
107
96
|
from optax._src.numerics import safe_int32_increment
|
|
108
97
|
from optax._src.numerics import safe_norm
|
|
109
98
|
from optax._src.numerics import safe_root_mean_squares
|
|
110
|
-
from optax._src.transform import add_decayed_weights
|
|
111
|
-
from optax._src.transform import add_noise
|
|
112
|
-
from optax._src.transform import AddDecayedWeightsState
|
|
113
|
-
from optax._src.transform import AddNoiseState
|
|
114
99
|
from optax._src.transform import apply_every
|
|
115
100
|
from optax._src.transform import ApplyEvery
|
|
116
101
|
from optax._src.transform import centralize
|
|
117
|
-
from optax._src.transform import ema
|
|
118
|
-
from optax._src.transform import EmaState
|
|
119
102
|
from optax._src.transform import normalize_by_update_norm
|
|
120
103
|
from optax._src.transform import scale
|
|
121
104
|
from optax._src.transform import scale_by_adadelta
|
|
@@ -157,35 +140,72 @@ from optax._src.transform import ScaleByRssState
|
|
|
157
140
|
from optax._src.transform import ScaleByRStdDevState
|
|
158
141
|
from optax._src.transform import ScaleByScheduleState
|
|
159
142
|
from optax._src.transform import ScaleBySM3State
|
|
160
|
-
from optax._src.transform import ScaleByTrustRatioState
|
|
161
|
-
from optax._src.transform import ScaleState
|
|
162
|
-
from optax._src.transform import trace
|
|
163
|
-
from optax._src.transform import TraceState
|
|
164
143
|
from optax._src.update import apply_updates
|
|
165
144
|
from optax._src.update import incremental_update
|
|
166
145
|
from optax._src.update import periodic_update
|
|
167
146
|
from optax._src.utils import multi_normal
|
|
168
147
|
from optax._src.utils import scale_gradient
|
|
169
148
|
from optax._src.utils import value_and_grad_from_state
|
|
170
|
-
|
|
171
|
-
from
|
|
172
|
-
|
|
173
|
-
from optax.
|
|
174
|
-
|
|
175
|
-
from optax.
|
|
176
|
-
|
|
177
|
-
from optax.
|
|
178
|
-
from optax._src.wrappers import MaskedNode
|
|
179
|
-
from optax._src.wrappers import MaskedState
|
|
180
|
-
from optax._src.wrappers import maybe_update
|
|
181
|
-
from optax._src.wrappers import MaybeUpdateState
|
|
182
|
-
from optax._src.wrappers import MultiSteps
|
|
183
|
-
from optax._src.wrappers import MultiStepsState
|
|
184
|
-
from optax._src.wrappers import ShouldSkipUpdateFunction
|
|
185
|
-
from optax._src.wrappers import skip_large_updates
|
|
186
|
-
from optax._src.wrappers import skip_not_finite
|
|
149
|
+
|
|
150
|
+
# TODO(mtthss): remove contrib aliases from flat namespace once users updated.
|
|
151
|
+
# Deprecated modules
|
|
152
|
+
from optax.contrib import (differentially_private_aggregate
|
|
153
|
+
as _deprecated_differentially_private_aggregate)
|
|
154
|
+
from optax.contrib import (DifferentiallyPrivateAggregateState
|
|
155
|
+
as _deprecated_DifferentiallyPrivateAggregateState)
|
|
156
|
+
from optax.contrib import dpsgd as _deprecated_dpsgd
|
|
187
157
|
|
|
188
158
|
|
|
159
|
+
# TODO(mtthss): remove aliases after updates.
|
|
160
|
+
adaptive_grad_clip = transforms.adaptive_grad_clip
|
|
161
|
+
AdaptiveGradClipState = EmptyState
|
|
162
|
+
clip = transforms.clip
|
|
163
|
+
clip_by_block_rms = transforms.clip_by_block_rms
|
|
164
|
+
clip_by_global_norm = transforms.clip_by_global_norm
|
|
165
|
+
ClipByGlobalNormState = EmptyState
|
|
166
|
+
ClipState = EmptyState
|
|
167
|
+
per_example_global_norm_clip = transforms.per_example_global_norm_clip
|
|
168
|
+
per_example_layer_norm_clip = transforms.per_example_layer_norm_clip
|
|
169
|
+
keep_params_nonnegative = transforms.keep_params_nonnegative
|
|
170
|
+
NonNegativeParamsState = transforms.NonNegativeParamsState
|
|
171
|
+
zero_nans = transforms.zero_nans
|
|
172
|
+
ZeroNansState = transforms.ZeroNansState
|
|
173
|
+
chain = transforms.chain
|
|
174
|
+
partition = transforms.partition
|
|
175
|
+
PartitionState = transforms.PartitionState
|
|
176
|
+
multi_transform = transforms.partition # for backwards compatibility
|
|
177
|
+
MultiTransformState = transforms.PartitionState # for backwards compatibility
|
|
178
|
+
named_chain = transforms.named_chain
|
|
179
|
+
trace = transforms.trace
|
|
180
|
+
TraceState = transforms.TraceState
|
|
181
|
+
ema = transforms.ema
|
|
182
|
+
EmaState = transforms.EmaState
|
|
183
|
+
add_noise = transforms.add_noise
|
|
184
|
+
AddNoiseState = transforms.AddNoiseState
|
|
185
|
+
add_decayed_weights = transforms.add_decayed_weights
|
|
186
|
+
AddDecayedWeightsState = EmptyState
|
|
187
|
+
ScaleByTrustRatioState = EmptyState
|
|
188
|
+
ScaleState = EmptyState
|
|
189
|
+
apply_if_finite = transforms.apply_if_finite
|
|
190
|
+
ApplyIfFiniteState = transforms.ApplyIfFiniteState
|
|
191
|
+
conditionally_mask = transforms.conditionally_mask
|
|
192
|
+
conditionally_transform = transforms.conditionally_transform
|
|
193
|
+
ConditionallyMaskState = transforms.ConditionallyMaskState
|
|
194
|
+
ConditionallyTransformState = transforms.ConditionallyTransformState
|
|
195
|
+
flatten = transforms.flatten
|
|
196
|
+
freeze = transforms.freeze
|
|
197
|
+
selective_transform = transforms.selective_transform
|
|
198
|
+
masked = transforms.masked
|
|
199
|
+
MaskedNode = transforms.MaskedNode
|
|
200
|
+
MaskedState = transforms.MaskedState
|
|
201
|
+
MultiSteps = transforms.MultiSteps
|
|
202
|
+
MultiStepsState = transforms.MultiStepsState
|
|
203
|
+
ShouldSkipUpdateFunction = transforms.ShouldSkipUpdateFunction
|
|
204
|
+
skip_large_updates = transforms.skip_large_updates
|
|
205
|
+
skip_not_finite = transforms.skip_not_finite
|
|
206
|
+
snapshot = transforms.snapshot
|
|
207
|
+
SnapshotState = transforms.SnapshotState
|
|
208
|
+
|
|
189
209
|
# TODO(mtthss): remove tree_utils aliases after updates.
|
|
190
210
|
tree_map_params = tree_utils.tree_map_params
|
|
191
211
|
bias_correction = tree_utils.tree_bias_correction
|
|
@@ -193,7 +213,7 @@ update_infinity_moment = tree_utils.tree_update_infinity_moment
|
|
|
193
213
|
update_moment = tree_utils.tree_update_moment
|
|
194
214
|
update_moment_per_elem_norm = tree_utils.tree_update_moment_per_elem_norm
|
|
195
215
|
|
|
196
|
-
# TODO(mtthss): remove schedules
|
|
216
|
+
# TODO(mtthss): remove schedules aliases from flat namespaces after user updates
|
|
197
217
|
constant_schedule = schedules.constant_schedule
|
|
198
218
|
cosine_decay_schedule = schedules.cosine_decay_schedule
|
|
199
219
|
cosine_onecycle_schedule = schedules.cosine_onecycle_schedule
|
|
@@ -236,13 +256,6 @@ softmax_cross_entropy_with_integer_labels = (
|
|
|
236
256
|
squared_error = losses.squared_error
|
|
237
257
|
sigmoid_focal_loss = losses.sigmoid_focal_loss
|
|
238
258
|
|
|
239
|
-
# pylint: disable=g-import-not-at-top
|
|
240
|
-
# TODO(mtthss): remove contrib aliases from flat namespace once users updated.
|
|
241
|
-
# Deprecated modules
|
|
242
|
-
from optax.contrib import differentially_private_aggregate as _deprecated_differentially_private_aggregate
|
|
243
|
-
from optax.contrib import DifferentiallyPrivateAggregateState as _deprecated_DifferentiallyPrivateAggregateState
|
|
244
|
-
from optax.contrib import dpsgd as _deprecated_dpsgd
|
|
245
|
-
|
|
246
259
|
_deprecations = {
|
|
247
260
|
# Added Apr 2024
|
|
248
261
|
"differentially_private_aggregate": (
|
|
@@ -269,9 +282,8 @@ _deprecations = {
|
|
|
269
282
|
_deprecated_dpsgd,
|
|
270
283
|
),
|
|
271
284
|
}
|
|
285
|
+
# pylint: disable=g-import-not-at-top
|
|
272
286
|
# pylint: disable=g-bad-import-order
|
|
273
|
-
import typing as _typing
|
|
274
|
-
|
|
275
287
|
if _typing.TYPE_CHECKING:
|
|
276
288
|
# pylint: disable=reimported
|
|
277
289
|
from optax.contrib import differentially_private_aggregate
|
|
@@ -280,7 +292,8 @@ if _typing.TYPE_CHECKING:
|
|
|
280
292
|
# pylint: enable=reimported
|
|
281
293
|
|
|
282
294
|
else:
|
|
283
|
-
from optax._src.deprecations import deprecation_getattr
|
|
295
|
+
from optax._src.deprecations import (deprecation_getattr
|
|
296
|
+
as _deprecation_getattr)
|
|
284
297
|
|
|
285
298
|
__getattr__ = _deprecation_getattr(__name__, _deprecations)
|
|
286
299
|
del _deprecation_getattr
|
|
@@ -290,7 +303,7 @@ del _typing
|
|
|
290
303
|
# pylint: enable=g-importing-member
|
|
291
304
|
|
|
292
305
|
|
|
293
|
-
__version__ = "0.2.
|
|
306
|
+
__version__ = "0.2.6"
|
|
294
307
|
|
|
295
308
|
__all__ = (
|
|
296
309
|
"adabelief",
|
|
@@ -371,21 +384,22 @@ __all__ = (
|
|
|
371
384
|
"MaskOrFn",
|
|
372
385
|
"MaskedState",
|
|
373
386
|
"matrix_inverse_pth_root",
|
|
374
|
-
"maybe_update",
|
|
375
|
-
"MaybeUpdateState",
|
|
376
387
|
"multi_normal",
|
|
377
|
-
"multi_transform",
|
|
388
|
+
"multi_transform", # for backwards compatibility
|
|
378
389
|
"MultiSteps",
|
|
379
390
|
"MultiStepsState",
|
|
380
|
-
"MultiTransformState",
|
|
391
|
+
"MultiTransformState", # for backwards compatibility
|
|
381
392
|
"nadam",
|
|
382
393
|
"nadamw",
|
|
394
|
+
"nnls",
|
|
383
395
|
"noisy_sgd",
|
|
384
396
|
"novograd",
|
|
385
397
|
"NonNegativeParamsState",
|
|
386
398
|
"ntxent",
|
|
387
399
|
"OptState",
|
|
388
400
|
"Params",
|
|
401
|
+
"partition",
|
|
402
|
+
"PartitionState",
|
|
389
403
|
"periodic_update",
|
|
390
404
|
"per_example_global_norm_clip",
|
|
391
405
|
"per_example_layer_norm_clip",
|