neon.optimizers.optimizer.Adadelta

class neon.optimizers.optimizer.Adadelta(stochastic_round=False, decay=0.95, epsilon=1e-06, param_clip_value=None, name=None)[source]

Bases: neon.optimizers.optimizer.Optimizer

Adadelta optimization algorithm.

Similar to RMSprop, Adadelta tracks the running average of the gradients, \(\mu_J\), over a window size \(1/\lambda\), where \(\lambda\) is the parameter decay. Adadelta also tracks an average of the recent update steps, which we denote as \(\mu_\theta\), and sets the learning rate as the ratio of the two averages:

\[\mu_J' &= \lambda\mu_J + (1-\lambda) (\nabla J)^2\]
\[\Delta \theta &= \sqrt{\frac{\mu_\theta + \epsilon}{\mu_J' + \epsilon}} \nabla J\]
\[\mu_\theta &= \lambda \mu_\theta + (1-\rho) (\Delta \theta)^2\]
\[\theta &= \theta - \Delta \theta\]

Note that the learning rate is a ratio of the average updates from the previous step, \(\mu_\theta\), divided by the average gradients including the current step, \(\mu'_J\).

Example usage:

from neon.optimizers import Adadelta
# use Adagrad with a learning rate of 0.01
optimizer = Adadelta(decay=0.95, epsilon=1e-6)
__init__(stochastic_round=False, decay=0.95, epsilon=1e-06, param_clip_value=None, name=None)[source]

Class constructor.

Parameters:
  • stochastic_round (bool) – Set this to True for stochastic rounding. If False rounding will be to nearest. If True will perform stochastic rounding using default width. Only affects the gpu backend.
  • decay – decay parameter in Adadelta
  • epsilon – epsilon parameter in Adadelta
  • param_clip_value (float, optional) – Value to element-wise clip parameters. Defaults to None.

Methods

__init__([stochastic_round, decay, epsilon, …]) Class constructor.
clip_gradient_norm(param_list, clip_norm) Returns a scaling factor to apply to the gradients.
clip_value(v[, abs_bound]) Element-wise clip a gradient or parameter tensor to between -abs_bound and +abs_bound.
gen_class(pdict)
get_description([skip]) Returns a dict that contains all necessary information needed to serialize this object.
optimize(layer_list, epoch) Apply the learning rule to all the layers and update the states.
recursive_gen(pdict, key) helper method to check whether the definition
be = None
classnm

Returns the class name.

clip_gradient_norm(param_list, clip_norm)

Returns a scaling factor to apply to the gradients.

The scaling factor is computed such that the root mean squared average of the scaled gradients across all layers will be less than or equal to the provided clip_norm value. This factor is always <1, so never scales up the gradients.

Parameters:
  • param_list (list) – List of layer parameters
  • clip_norm (float, optional) – Target norm for the gradients. If not provided the returned scale_factor will equal 1.
Returns:

Computed scale factor.

Return type:

scale_factor (float)

clip_value(v, abs_bound=None)

Element-wise clip a gradient or parameter tensor to between -abs_bound and +abs_bound.

Parameters:
  • v (tensor) – Tensor of gradients or parameters for a single layer
  • abs_bound (float, optional) – Value to element-wise clip gradients or parameters. Defaults to None.
Returns:

Tensor of clipped gradients or parameters.

Return type:

v (tensor)

gen_class(pdict)
get_description(skip=[], **kwargs)

Returns a dict that contains all necessary information needed to serialize this object.

Parameters:skip (list) – Objects to omit from the dictionary.
Returns:Dictionary format for object information.
Return type:(dict)
modulenm

Returns the full module path.

optimize(layer_list, epoch)[source]

Apply the learning rule to all the layers and update the states.

Parameters:
  • param_list (list) – a list of tuples of the form ((param, grad), state), corresponding to parameters, grads, and states of layers to be updated
  • epoch (int) – the current epoch, needed for the Schedule object.
recursive_gen(pdict, key)

helper method to check whether the definition dictionary is defining a NervanaObject child, if so it will instantiate that object and replace the dictionary element with an instance of that object