class_docstr: Wrapper for batching metrics.
  
  This can be used to wrap any python metric that takes a single trajectory to
  produce a batched version of the metric that takes a batch of trajectories.
class_docstr_tok: ["Wrapper","for","batching","metrics",".","This","can","be","used","to","wrap","any","python","metric","that","takes","a","single","trajectory","to","produce","a","batched","version","of","the","metric","that","takes","a","batch","of","trajectories","."]
docstr: Creates a BatchedPyMetric metric.
docstr_tok: ["Creates","a","BatchedPyMetric","metric","."]
code: def __init__(
      self,
      metric_class: py_metric.PyMetric.__class__,
      metric_args: Optional[Any] = None,
      name: Optional[Text] = None,
      batch_size: Optional[types.Int] = None,
      dtype: np.dtype = np.float32,
      prefix: Text = "Metrics",
  ):
      """Creates a BatchedPyMetric metric."""
      self._metric_class = metric_class
      if metric_args is None:
          self._metric_args = {}
      else:
          self._metric_args = metric_args
  
      if not name:
          name = self._metric_class(**self._metric_args).name
      super(BatchedPyMetric, self).__init__(name, prefix=prefix)
  
      self._built = False
      self._dtype = dtype
      if batch_size is not None:
          self.build(batch_size)
  
file_path: agents/tf_agents/metrics/batched_py_metric.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import Any, Optional, Text
  import numpy
  from tf_agents.metrics import py_metric
  from tf_agents.trajectories import trajectory
  from tf_agents.typing import types
  from tf_agents.utils import nest_utils
label_desc: Use image node_id 1 to create a new BatchedPyMetric object from inherited base classes: py_metric with example: obj = BatchedPyMetric(metric_class, metric_args, name, batch_size, dtype, prefix)