class_docstr: A class to wrap training code.
docstr: Logs the controller's progress for this training epoch.
code: def _summarize_controller_train(
      self,
      total_loss,
      adv_history,
      entropy_history,
      reward_history,
      avg_reward_base,
      dags,
  ):
      """Logs the controller's progress for this training epoch."""
      cur_loss = total_loss / self.args.log_step
  
      avg_adv = np.mean(adv_history)
      avg_entropy = np.mean(entropy_history)
      avg_reward = np.mean(reward_history)
  
      if avg_reward_base is None:
          avg_reward_base = avg_reward
  
      logger.info(
          f"| epoch {self.epoch:3d} | lr {self.controller_lr:.5f} "
          f"| R {avg_reward:.5f} | entropy {avg_entropy:.4f} "
          f"| loss {cur_loss:.5f}"
      )
  
      # Tensorboard
      if self.tb is not None:
          self.tb.scalar_summary(
              "controller/loss", cur_loss, self.controller_step
          )
          self.tb.scalar_summary(
              "controller/reward", avg_reward, self.controller_step
          )
          self.tb.scalar_summary(
              "controller/reward-B_per_epoch",
              avg_reward - avg_reward_base,
              self.controller_step,
          )
          self.tb.scalar_summary(
              "controller/entropy", avg_entropy, self.controller_step
          )
          self.tb.scalar_summary(
              "controller/adv", avg_adv, self.controller_step
          )
  
          paths = []
          for dag in dags:
              fname = (
                  f"{self.epoch:03d}-{self.controller_step:06d}-"
                  f"{avg_reward:6.4f}.png"
              )
              path = os.path.join(
                  self.args.model_dir, "networks", fname
              )
              utils.draw_network(dag, path)
              paths.append(path)
  
          self.tb.image_summary(
              "controller/sample", paths, self.controller_step
          )
  
imports: import contextlib
  import glob
  import math
  import os
  import numpy
  import scipy.signal
  from tensorboard import TensorBoard
  import torch
  from torch import nn
  import torch.nn.parallel
  from torch.autograd import Variable
  import models
  import utils
label_desc: Use image node_id 18 for calling the Trainer obj's underlying member method code with example usage: obj._summarize_controller_train(total_loss, adv_history, entropy_history, reward_history, avg_reward_base, dags) without return types