PrecisionPlugin¶
-
class
pytorch_lightning.plugins.precision.PrecisionPlugin[source]¶ Bases:
pytorch_lightning.plugins.base_plugin.PluginBase class for all plugins handling the precision-specific parts of the training. The static classattributes EPSILON and precision must be overwritten in child-classes and their default values reflect fp32 training.
-
backward(model, closure_loss, optimizer, opt_idx, should_accumulate, *args, **kwargs)[source]¶ performs the actual backpropagation
- Parameters
- Return type
-
clip_grad_by_norm(optimizer, clip_val, norm_type=2.0, eps=1e-06)[source]¶ Clip gradients by norm
- Return type
-
clip_gradients(optimizer, clip_val, gradient_clip_algorithm=<GradClipAlgorithmType.NORM: 'norm'>, model=None)[source]¶ Clips the gradients
- Return type
-
connect(model, optimizers, lr_schedulers)[source]¶ Connects this plugin to the accelerator and the training process
-
master_params(optimizer)[source]¶ The master params of the model. Returns the plain model params here. Maybe different in other precision plugins.
- Return type
Iterator[Parameter]
-