chainer.optimizer_hooks.GradientHardClipping

class chainer.optimizer_hooks.GradientHardClipping(lower_bound, upper_bound)[source]

Optimizer/UpdateRule hook function for gradient clipping.

This hook function clips all gradient arrays to be within a lower and upper bound.

Parameters:
  • lower_bound (float) – The lower bound of the gradient value.
  • upper_bound (float) – The upper bound of the gradient value.
Variables:
  • lower_bound (float) – The lower bound of the gradient value.
  • upper_bound (float) – The upper bound of the gradient value.
  • timing (string) – Specifies when this hook should be called by the Optimizer/UpdateRule. Valid values are ‘pre’ (before any updates) and ‘post’ (after any updates).

New in version 4.0.0: The timing parameter.

Methods

__call__(rule, param)[source]

Call self as a function.

Attributes

call_for_each_param = True
name = 'GradientHardClipping'
timing = 'pre'