def backward(self, loss, update_master_grads=False):
        """
        Computes the sum of gradients of the given tensor w.r.t. graph leaves.
        Compared to a regular backwards call , this function dynamically scales the loss
        to avoid gradient underflow.
        """
        loss = loss * self.scaler.loss_scale
        loss.backward()
        self._grads_are_scaled = True

        Computes the sum of gradients of the given tensor w.r.t. graph leaves.
        Compared to a regular backwards call , this function dynamically scales the loss
        to avoid gradient underflow.
        
EVA-CLIP/rei/training/fp16.py