Skip to content

Commit

Permalink
Avoid one layer of indirection by colocating the source and the subpa…
Browse files Browse the repository at this point in the history
…ckage __init__ for optax.contrib.

WARNING: This can potentially break the loading of a saved optimizer states if the path of the MechanicState class is tied to the saved data (e.g. via pickling). This kind of pickling issue can be fixed at load time by adding an import stub at the old location, or by adding a `sys.modules` entry for the old path.
PiperOrigin-RevId: 570045729
  • Loading branch information
mtthss authored and OptaxDev committed Oct 3, 2023
1 parent e43f9f5 commit b93e5a7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions optax/contrib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# ==============================================================================
"""Contributed optimizers in Optax."""

from optax._src.contrib.mechanic import MechanicState
from optax._src.contrib.mechanic import mechanize
from optax.contrib.mechanic import MechanicState
from optax.contrib.mechanic import mechanize
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from optax._src import numerics
from optax._src import state_utils
from optax._src import update
from optax._src.contrib import mechanic
from optax.contrib import mechanic


# TODO(harshm): make LARS and Fromage work with mechanic.
Expand Down

0 comments on commit b93e5a7

Please sign in to comment.