Skip to content

Commit

Permalink
PR #17974: [keras/models] Standardise docstring usage of "Default to"
Browse files Browse the repository at this point in the history
Imported from GitHub PR #17974

This is one of many PRs. Discussion + request to split into multiple PRs @ #17748
Copybara import of the project:

--
b96f2bc by Samuel Marks <[email protected]>:

[keras/models/cloning.py,keras/models/sharpness_aware_minimization.py] Standardise docstring usage of "Default to"

--
5719f7b by Samuel Marks <[email protected]>:

[keras/models/sharpness_aware_minimization.py] Use backticks for defaults in docstrings

Merging this change closes #17974

FUTURE_COPYBARA_INTEGRATE_REVIEW=#17974 from SamuelMarks:keras.models-defaults-to 5719f7b
PiperOrigin-RevId: 529706730
  • Loading branch information
tensorflower-gardener committed May 5, 2023
1 parent b7e9134 commit 386fc71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion keras/models/cloning.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,12 +484,13 @@ def clone_model(model, input_tensors=None, clone_function=None):
model (except `InputLayer` instances). It takes as argument the
layer instance to be cloned, and returns the corresponding layer
instance to be used in the model copy. If unspecified, this callable
defaults to the following serialization/deserialization function:
becomes the following serialization/deserialization function:
`lambda layer: layer.__class__.from_config(layer.get_config())`.
By passing a custom callable, you can customize your copy of the
model, e.g. by wrapping certain layers of interest (you might want
to replace all `LSTM` instances with equivalent
`Bidirectional(LSTM(...))` instances, for example).
Defaults to `None`.
Returns:
An instance of `Model` reproducing the behavior
Expand Down
8 changes: 4 additions & 4 deletions keras/models/sharpness_aware_minimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ class SharpnessAwareMinimization(Model):
Args:
model: `tf.keras.Model` instance. The inner model that does the
forward-backward pass.
rho: float, defaults to 0.05. The gradients scaling factor.
num_batch_splits: int, defaults to None. The number of mini batches to
rho: float. The gradients scaling factor. Defaults to `0.05`.
num_batch_splits: int. The number of mini batches to
split into from each data batch. If None, batches are not split into
sub-batches.
name: string, defaults to None. The name of the SAM model.
sub-batches. Defaults to `None`.
name: string. The name of the SAM model. Defaults to `None`.
Reference:
[Pierre Foret et al., 2020](https://arxiv.org/abs/2010.01412)
Expand Down

0 comments on commit 386fc71

Please sign in to comment.