docs: def _define_step(self, done, score, summary):
      """Combine operations of a phase.
  
      Keeps track of the mean score and when to report it.
  
      Args:
        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.
  
      Returns:
        Tuple of summary tensor, mean score, and new global step. The mean score
        is zero for non reporting steps.
      """
      if done.shape.ndims == 0:
        done = done[None]
      if score.shape.ndims == 0:
        score = score[None]
      score_mean = streaming_mean.StreamingMean((), tf.float32)
      with tf.control_dependencies([done, score, summary]):
        done_score = tf.gather(score, tf.where(done)[:, 0])
        submit_score = tf.cond(
            tf.reduce_any(done), lambda: score_mean.submit(done_score), tf.no_op)
      with tf.control_dependencies([submit_score]):
        mean_score = tf.cond(self._report, score_mean.clear, float)
        steps_made = tf.shape(score)[0]
        next_step = self._step.assign_add(steps_made)
      with tf.control_dependencies([mean_score, next_step]):
        return tf.identity(summary), mean_score, next_step, steps_made