docs: def add_phase(
        self, name, done, score, summary, steps,
        report_every=None, log_every=None, checkpoint_every=None, feed=None):
      """Add a phase to the loop protocol.
  
      If the model breaks long computation into multiple steps, the done tensor
      indicates whether the current score should be added to the mean counter.
      For example, in reinforcement learning we only have a valid score at the
      end of the episode.
  
      Score and done tensors can either be scalars or vectors, to support
      single and batched computations.
  
      Args:
        name: Name for the phase, used for the summary writer.
        done: Tensor indicating whether current score can be used.
        score: Tensor holding the current, possibly intermediate, score.
        summary: Tensor holding summary string to write if not an empty string.
        steps: Duration of the phase in steps.
        report_every: Yield mean score every this number of steps.
        log_every: Request summaries via `log` tensor every this number of steps.
        checkpoint_every: Write checkpoint every this number of steps.
        feed: Additional feed dictionary for the session run call.
  
      Raises:
        ValueError: Unknown rank for done or score tensors.
      """
      done = tf.convert_to_tensor(done, tf.bool)
      score = tf.convert_to_tensor(score, tf.float32)
      summary = tf.convert_to_tensor(summary, tf.string)
      feed = feed or {}
      if done.shape.ndims is None or score.shape.ndims is None:
        raise ValueError("Rank of 'done' and 'score' tensors must be known.")
      writer = self._logdir and tf.summary.FileWriter(
          os.path.join(self._logdir, name), tf.get_default_graph(),
          flush_secs=60)
      op = self._define_step(done, score, summary)
      batch = 1 if score.shape.ndims == 0 else score.shape[0].value
      self._phases.append(_Phase(
          name, writer, op, batch, int(steps), feed, report_every,
          log_every, checkpoint_every))