class_docstr: Actor.
  
  The actor manages interactions between a policy and an environment. Users
  should configure the metrics and summaries for a specific task like evaluation
  or data collection.
  
  The main point of access for users is  the `run` method. This will iterate
  over either n `steps_per_run` or `episodes_per_run`. At least one of
  `steps_per_run` or `episodes_per_run` must be provided.
class_docstr_tok: ["Actor",".","The","actor","manages","interactions","between","a","policy","and","an","environment",".","Users","should","configure","the","metrics","and","summaries","for","a","specific","task","like","evaluation","or","data","collection",".","The","main","point","of","access","for","users","is","the","`","run","`","method",".","This","will","iterate","over","either","n","`","steps_per_run","`","or","`","episodes_per_run","`",".","At","least","one","of","`","steps_per_run","`","or","`","episodes_per_run","`","must","be","provided","."]
docstr: Generates scalar summaries for the actor metrics.
docstr_tok: ["Generates","scalar","summaries","for","the","actor","metrics","."]
code: def write_metric_summaries(self):
      """Generates scalar summaries for the actor metrics."""
      if self._metrics is None:
          return
      with self._summary_writer.as_default(), common.soft_device_placement(), tf.summary.record_if(
          lambda: True
      ):
          # Generate summaries against the train_step
          for m in self._metrics:
              tag = m.name
              try:
                  tf.summary.scalar(
                      name=os.path.join("Metrics/", self._name, tag),
                      data=m.result(),
                      step=self._train_step,
                  )
              except ValueError:
                  logging.error(
                      "Scalar summary could not be written for metric %s",
                      m,
                  )
              # Generate summaries against the reference_metrics
              for reference_metric in self._reference_metrics:
                  tag = "Metrics/{}/{}".format(
                      m.name, reference_metric.name
                  )
                  try:
                      tf.summary.scalar(
                          name=os.path.join(self._name, tag),
                          data=m.result(),
                          step=reference_metric.result(),
                      )
                  except ValueError:
                      logging.error(
                          "Scalar summary could not be written for reference_metric %s",
                          m,
                      )
          for m in self._image_metrics:
              tag = m.name
              try:
                  tf.summary.image(
                      name=os.path.join("Metrics/", self._name, tag),
                      data=m.result(),
                      step=self._train_step,
                  )
              except ValueError:
                  logging.error(
                      "Image summary could not be written for metric %s",
                      m,
                  )
  
imports: import os
  from absl import logging
  import gin
  import tensorflow.compat.v2
  from tf_agents.drivers import py_driver
  from tf_agents.environments import py_environment
  from tf_agents.environments import tf_environment
  from tf_agents.metrics import py_metrics
  from tf_agents.utils import common
label_desc: Use image node_id 9 for calling the Actor obj's underlying member method code with example usage: obj.write_metric_summaries() without return types