docstr: Scale the loss before computing gradients.
  
  Scales the loss before gradients are computed in a `train_step`. This
  is primarily useful during mixed precision training to prevent numeric
  underflow.
docstr_tok: ["Scale","the","loss","before","computing","gradients",".","Scales","the","loss","before","gradients","are","computed","in","a","`","train_step","`",".","This","is","primarily","useful","during","mixed","precision","training","to","prevent","numeric","underflow","."]
code: def scale_loss(self, loss):
      """Scale the loss before computing gradients.
  
      Scales the loss before gradients are computed in a `train_step`. This
      is primarily useful during mixed precision training to prevent numeric
      underflow.
      """
      if self.loss_scale_factor is not None:
          return loss * self.loss_scale_factor
      return loss
  
imports: import re
  import warnings
  import numpy
  from keras import backend
  from keras import initializers
  from keras import ops
  from keras.optimizers.schedules import learning_rate_schedule
  from keras.saving import serialization_lib
  from keras.utils import tracking
  from keras.utils.naming import auto_name
label_desc: Use image node_id 21 for calling the BaseOptimizer obj's underlying member method code with example usage: obj.scale_loss(loss) and returns: loss, unknown