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: Processes the batched_trajectory to update the metric.
  
  Args:
    batched_trajectory: A Trajectory containing batches of experience.
  
  Raises:
    ValueError: If the batch size is an unexpected value.
docstr_tok: ["Processes","the","batched_trajectory","to","update","the","metric",".","Args",":","batched_trajectory",":","A","Trajectory","containing","batches","of","experience",".","Raises",":","ValueError",":","If","the","batch","size","is","an","unexpected","value","."]
code: def call(self, batched_trajectory: traj.Trajectory):
      """Processes the batched_trajectory to update the metric.
  
      Args:
        batched_trajectory: A Trajectory containing batches of experience.
  
      Raises:
        ValueError: If the batch size is an unexpected value.
      """
      trajectories = nest_utils.unstack_nested_arrays(
          batched_trajectory
      )
      batch_size = len(trajectories)
      if not self._built:
          self.build(batch_size)
      if batch_size != len(self._metrics):
          raise ValueError(
              "Batch size {} does not match previously set batch "
              "size {}. Make sure your batch size is set correctly "
              "in BatchedPyMetric initialization and that the batch "
              "size remains constant.".format(
                  batch_size, len(self._metrics)
              )
          )
  
      for metric, trajectory in zip(self._metrics, trajectories):
          metric(trajectory)
  
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 3 for calling the BatchedPyMetric obj's underlying member method code with example usage: obj.call(batched_trajectory) without return types