Skip to content

Commit b12b9a1

Browse files
qlzh727mchinentensorflower-gardener
authored
Cherrypick 2 more changes for the optimizer docstring fix. (#17165)
* keras: fix typo in keras optimizers migration recommendation tf.keras.optimizer.legacy -> tf.keras.optimizers.legacy PiperOrigin-RevId: 481720094 * Keras: Fix docstring for tf.keras.optimizer. -> tf.keras.optimizers. PiperOrigin-RevId: 481721074 Co-authored-by: Michael Chinen <[email protected]> Co-authored-by: A. Unique TensorFlower <[email protected]>
1 parent 1b83c91 commit b12b9a1

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

keras/mixed_precision/loss_scale_optimizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,14 +1125,14 @@ def __init__(
11251125
# Give better error message if the OptimizerV2 class is passed
11261126
# instead of the new experimental optimizer.
11271127
raise TypeError(
1128-
"You passed a `tf.keras.optimizer.Optimizer` instance to "
1128+
"You passed a `tf.keras.optimizers.Optimizer` instance to "
11291129
"LossScaleOptimizerV3, but only the new experimental "
11301130
"optimizer defined in "
11311131
"keras/optimizer_expeirmental/optimizer.py can be "
11321132
"passed. Please use "
11331133
"`tf.keras.mixed_precision.LossScaleOptimizer` "
11341134
"instead of LossScaleOptimizerV3, as the former supports "
1135-
"`tf.keras.optimizer.Optimizer`s. Got optimizer: "
1135+
"`tf.keras.optimizers.Optimizer`s. Got optimizer: "
11361136
f"{inner_optimizer}"
11371137
)
11381138
raise TypeError(

keras/optimizers/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def convert_to_legacy_optimizer(optimizer):
196196
197197
This function takes in a `tf.keras.optimizers.experimental.Optimizer`
198198
instance and converts it to the corresponding
199-
`tf.keras.optimizer.legacy.Optimizer` instance.
199+
`tf.keras.optimizers.legacy.Optimizer` instance.
200200
For example, `tf.keras.optimizers.experimental.Adam(...)` to
201201
`tf.keras.optimizers.legacy.Adam(...)`.
202202

keras/optimizers/optimizer_experimental/optimizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def _create_or_restore_slot_variable(self, **kwargs):
127127
"errors. Please update the optimizer referenced in your code "
128128
"to be an instance of "
129129
"`tf.keras.optimizers.legacy.Optimizer`, e.g.: "
130-
f"`tf.keras.optimizer.legacy.{self.__class__.__name__}`."
130+
f"`tf.keras.optimizers.legacy.{self.__class__.__name__}`."
131131
)
132132

133133
def _var_key(self, variable):

0 commit comments

Comments
 (0)