GradientClippingStep¶
Chainable step that clips incoming gradients based on their norm, ensuring that the gradient norm does not exceed a provided threshold.
This implements several variants, including elementwise clipping, layerwise clipping, global clipping (as in Pascanu et al, 2012), and adaptive clipping (relative to the prior parameter norm). The adaptive clipping follows Brock, Smith, De, and Simonyan (2021), "High-Performance Large-Scale Image Recognition Without Normalization.". Unlike the end-to-end steps (named after specific published algorithms), this is a chainable step (to be used with the ChainedStep node) that takes in a gradient and outputs a modified gradient, and it would usually be combined with other steps (like scaling by the learning rate) to yield a full optimizer step. More Info... Version 0.2.0
Ports/Properties¶
gradients¶
Gradients to be transformed.
weights¶
Optional current weights.
state¶
Explicit state of the node.
variant¶
Variant of gradient clipping to apply. Per-weight means that each individual weight update is limited to +/- threshold, per-layer means that the gradient for each parameter vector/matrix is scaled such that its norm is at most threshold, and global means that the gradient for the entire parameter set is scaled such that its norm is at most threshold. Per-weight-relative means that each individual weight update is limited to +/- threshold times the norm of the corresponding parameter before the update (requires prior parameter values to be provided to the StepUpdate node).
threshold¶
Threshold value. A typical value is 1.0, but depending on the network and data, other values, may be explored.
epsilon¶
Small value to prevent clipping of zero-initialized parameters. Only used for per-weight-relative.
set_breakpoint¶
Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.
metadata¶
User-definable meta-data associated with the node. Usually reserved for technical purposes.