SGD
Inherits From: Optimizer
Defined in tensorflow/python/keras/_impl/keras/optimizers.py.
Stochastic gradient descent optimizer.
Includes support for momentum, learning rate decay, and Nesterov momentum.
lr: float >= 0. Learning rate.momentum: float >= 0. Parameter updates momentum.decay: float >= 0. Learning rate decay over each update.nesterov: boolean. Whether to apply Nesterov momentum.__init____init__(
lr=0.01,
momentum=0.0,
decay=0.0,
nesterov=False,
**kwargs
)
from_configfrom_config(
cls,
config
)
get_configget_config()
get_gradientsget_gradients(
loss,
params
)
get_updatesget_updates(
loss,
params
)
get_weightsget_weights()
Returns the current value of the weights of the optimizer.
A list of numpy arrays.
set_weightsset_weights(weights)
Sets the weights of the optimizer, from Numpy arrays.
Should only be called after computing the gradients (otherwise the optimizer has no weights).
weights: a list of Numpy arrays. The number of arrays and their shape must match number of the dimensions of the weights of the optimizer (i.e. it should match the output of get_weights).ValueError: in case of incompatible weight shapes.
© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/keras/optimizers/SGD