docstr: Gets called at the end of a stage.
docstr_tok: ["Gets","called","at","the","end","of","a","stage","."]
code: def on_stage_end(self, stage, stage_loss, epoch=None):
      """Gets called at the end of a stage."""
      if stage == sb.Stage.TRAIN:
          g_loss = torch.tensor(self.metrics["G"])
          d_loss = torch.tensor(self.metrics["D"])
          print("Avg G loss: %.2f" % torch.mean(g_loss))
          print("Avg D loss: %.2f" % torch.mean(d_loss))
          print("train loss: ", stage_loss)
      elif stage == sb.Stage.VALID:
          print("Completed epoch %d" % epoch)
          print("Valid loss: %.3f" % stage_loss)
      else:
          self.test_loss = stage_loss
  
file_path: speechbrain/tests/integration/enhance_GAN/example_enhance_gan_experiment.py
imports: import torch
  import pathlib
  import speechbrain
  from hyperpyyaml import load_hyperpyyaml
label_desc: Use image node_id 5 for calling the EnhanceGanBrain obj's underlying member method code with example usage: obj.on_stage_end(stage, stage_loss, epoch) without return types