code: def on_backward_end(self, iteration:int, **kwargs)->None:
          "Callback function that writes backward end appropriate data to Tensorboard."
          if iteration == 0: return
          self._update_batches_if_needed()
          #TODO:  This could perhaps be implemented as queues of requests instead but that seemed like overkill. 
          # But I'm not the biggest fan of maintaining these boolean flags either... Review pls.
          if iteration % self.stats_iters == 0: self.gen_stats_updated, self.crit_stats_updated = False, False
          if not (self.gen_stats_updated and self.crit_stats_updated): self._write_model_stats(iteration=iterationf on_backward_end(self, iteration:int, **kwargs)->None:
          "Callback function that writes backward end appropriate data to Tensorboard."
          if iteration == 0: return
          self._update_batches_if_needed()
          #TODO:  This could perhaps be implemented as queues of requests instead but that seemed like overkill. 
          # But I'm not the biggest fan of maintaining these boolean flags either... Review pls.
          if iteration % self.stats_iters == 0: self.gen_stats_updated, self.crit_stats_updated = False, False
          if not (self.gen_stats_updated and self.crit_stats_updated): self._write_model_stats(iteration=iteration)
docs: Callback function that writes backward end appropriate data to Tensorboard.