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
- Variables
~optimizer_hooks.GradientHardClipping.lower_bound (float) – The lower bound of the gradient value.
~optimizer_hooks.GradientHardClipping.upper_bound (float) – The upper bound of the gradient value.
~optimizer_hooks.GradientHardClipping.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).
~optimizer_hooks.GradientHardClipping.call_for_each_param (bool) – Specifies if this hook is called for each parameter (
True
) or only once (False
) by an optimizer to which this hook is registered. This function does not expect users to switch the value from default one, which is True.
New in version 4.0.0: The timing parameter.
Methods
- __eq__(value, /)¶
Return self==value.
- __ne__(value, /)¶
Return self!=value.
- __lt__(value, /)¶
Return self<value.
- __le__(value, /)¶
Return self<=value.
- __gt__(value, /)¶
Return self>value.
- __ge__(value, /)¶
Return self>=value.
Attributes
- call_for_each_param = True¶
- name = 'GradientHardClipping'¶
- timing = 'pre'¶