def model_backward(self, loss):
    self.detect_anomaly(loss)
    if (not self.use_amp):
        loss.backward()
    else:
        self.scaler.scale(loss).backward()
def model_backward(self, loss):
    self.detect_anomaly(loss)
    if (not self.use_amp):
        loss.backward()
    else:
        self.scaler.scale(loss).backward()