def on_backward_end(self, **kwargs):
        "Clip the gradient before the optimizer step."
        if self.clip: nn.utils.clip_grad_norm_(self.learn.model.parameters(), self.clip)
def on_backward_end ( self , ** kwargs ) : if self . clip : nn . utils . clip_grad_norm_ ( self . learn . model . parameters ( ) , self . clip )
Clip the gradient before the optimizer step.