shiba/trainer.py
def backward(self):
        """backward pass, optionally with apex loss scaling"""
        if self.use_apex:
            try:
                from apex import amp
                with amp.scale_loss(self.out['loss'], self.optimizer) as scaled_loss:
                    scaled_loss.backward()
            except ImportError:
                pass
        else:
            self.out['loss'].backward()
backward pass, optionally with apex loss scaling
backward pass, optionally with apex loss scaling
backward pass optionally with apex loss scaling
def backward(self):
        if self.use_apex:
            try:
                from apex import amp
                with amp.scale_loss(self.out['loss'], self.optimizer) as scaled_loss:
                    scaled_loss.backward()
            except ImportError:
                pass
        else:
            self.out['loss'].backward()
def backward ( self ) : if self . use_apex : try : from apex import amp with amp . scale_loss ( self . out [ 'loss' ] , self . optimizer ) as scaled_loss : scaled_loss . backward ( ) except ImportError : pass else : self . out [ 'loss' ] . backward ( )
backward pass, optionally with apex loss scaling
backward pass optionally with apex loss scaling
"""backward pass, optionally with apex loss scaling"""
self