GradientAbsClippingTrainingCallback

class GradientAbsClippingTrainingCallback(clip_value)[source]

Bases: TrainingCallback

A callback for gradient clipping before stepping the optimizer with torch.nn.utils.clip_grad_value_().

Initialize the callback.

Parameters:

clip_value (float) – The maximum absolute value in gradients, cf. torch.nn.utils.clip_grad_value_(). If None, no gradient clipping will be used.

Methods Summary

pre_step(**kwargs)

Call before the optimizer's step.

Methods Documentation

pre_step(**kwargs)[source]

Call before the optimizer’s step.

Return type:

None

Parameters:

kwargs (Any) –