code: def on_backward_begin(self, last_loss, last_output, **kwargs):
          "Record `last_loss` in the proper list."
          last_loss = last_loss.detach().cpu()
          if self.gen_mode:
              self.smoothenerG.add_value(last_loss)
              self.glosses.append(self.smoothenerG.smooth)
              self.last_gen = last_output.detach().cpu()
          else:
              self.smoothenerC.add_value(last_loss)
              self.closses.append(self.smoothenerC.smoothf on_backward_begin(self, last_loss, last_output, **kwargs):
          "Record `last_loss` in the proper list."
          last_loss = last_loss.detach().cpu()
          if self.gen_mode:
              self.smoothenerG.add_value(last_loss)
              self.glosses.append(self.smoothenerG.smooth)
              self.last_gen = last_output.detach().cpu()
          else:
              self.smoothenerC.add_value(last_loss)
              self.closses.append(self.smoothenerC.smooth)
docs: Record `last_loss` in the proper list.