import tensorflow as tf

      tf.compat.v2.summary.scalar(
          name="relabel_task_optimal", data=relabel_opt_frac, step=global_step)

      # What are the average Q values of the original tasks?
      if batch_size == num_tasks:
        indices = tf.transpose(tf.stack([orig_indices, orig_indices], axis=0))
        orig_q_vals = tf.gather_nd(logits_vec, indices)
        tf.compat.v2.summary.scalar(
            name="orig_q_vals",
            data=tf.reduce_mean(orig_q_vals),
            step=global_step,
        )

      # What are the average Q values of the relabelled tasks?
      indices = tf.transpose(
          tf.stack([orig_indices, tf.squeeze(relabel_indices)], axis=0))
      relabel_q_vals = tf.gather_nd(logits_vec, indices)
      tf.compat.v2.summary.scalar(
          name="relabel_q_vals",
          data=tf.reduce_mean(relabel_q_vals),
          step=global_step,
      )

      max_q = tf.reduce_max(logits_vec, axis=1)
      tf.compat.v2.summary.scalar(
          name="max_q", data=tf.reduce_mean(max_q), step=global_step)

    ### End metrics

    # For both state-centric and goal-centric relabelling, the implementation of
