From b96f2bcebac884a0654e74ad62235db4efbb56d9 Mon Sep 17 00:00:00 2001 From: Samuel Marks <807580+SamuelMarks@users.noreply.github.com> Date: Wed, 12 Apr 2023 20:36:46 -0400 Subject: [PATCH] [keras/models/cloning.py,keras/models/sharpness_aware_minimization.py] Standardise docstring usage of "Default to" --- keras/models/cloning.py | 3 ++- keras/models/sharpness_aware_minimization.py | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/keras/models/cloning.py b/keras/models/cloning.py index b490777fd81..6c71fde3299 100644 --- a/keras/models/cloning.py +++ b/keras/models/cloning.py @@ -474,12 +474,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 diff --git a/keras/models/sharpness_aware_minimization.py b/keras/models/sharpness_aware_minimization.py index 33e01cd59e0..70543101cd9 100644 --- a/keras/models/sharpness_aware_minimization.py +++ b/keras/models/sharpness_aware_minimization.py @@ -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)