GradClip

class lib.training.optimizer.GradClip(method: Literal['autoclip', 'global_norm', 'norm', 'value'], value: float, autoclip_history: int = 10000)

Bases: object

Handles the clipping of gradients based on user supplied parameters

Parameters:
  • method (T.Literal['autoclip', 'global_norm', 'norm', 'value']) – The clipping method to use

  • value (float) – The clipping value to use. For autoclip this is the percentile to clip at (a value of 1.0 will clip at the 10th percentile a value of 2.5 will clip at the 25th percentile etc)

  • autoclip_history (int) – The history length for auto clipping. Default: 10000

Methods Summary

__call__(parameters)

Clip the given parameters by the chosen method

Methods Documentation

__call__(parameters: list[Parameter]) None

Clip the given parameters by the chosen method

Parameters:

parameters (list[Parameter]) – The parameters to clip

Return type:

None

__call__(parameters: list[Parameter]) None

Clip the given parameters by the chosen method

Parameters:

parameters (list[Parameter]) – The parameters to clip

Return type:

None