Given a tensor t, and a maximum clip value clip_norm, this operation
normalizes t so that its average L2-norm is less than or equal to
clip_norm. Specifically, if the average L2-norm is already less than or
equal to clip_norm, then t is not modified. If the average L2-norm is
greater than clip_norm, then this operation returns a tensor of the same
type and shape as t with its values set to:
t * clip_norm / l2norm_avg(t)
In this case, the average L2-norm of the output tensor is clip_norm.
This operation is typically used to clip gradients before applying them with
an optimizer.
Args
t
A Tensor.
clip_norm
A 0-D (scalar) Tensor > 0. A maximum clipping value.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2021-02-18 UTC."],[],[]]