class_docstr: Collects already postprocessed (single agent) samples for one policy.
  
  Samples come in through already postprocessed SampleBatches, which
  contain single episode/trajectory data for a single agent and are then
  appended to this policy's buffers.
docstr: Builds a SampleBatch for this policy from the collected data.
  
  Also resets all buffers for further sample collection for this policy.
  
  Returns:
      SampleBatch: The SampleBatch with all thus-far collected data for
          this policy.
code: def build(self):
      """Builds a SampleBatch for this policy from the collected data.
  
      Also resets all buffers for further sample collection for this policy.
  
      Returns:
          SampleBatch: The SampleBatch with all thus-far collected data for
              this policy.
      """
      # Create batch from our buffers.
      batch = concat_samples(self.batches)
      # Clear batches for future samples.
      self.batches = []
      # Reset agent steps to 0.
      self.agent_steps = 0
      # Add num_grad_updates counter to the policy's batch.
      batch.num_grad_updates = self.policy.num_grad_updates
  
      return batch
  
imports: import collections
  from gymnasium.spaces import Space
  import logging
  import numpy
  import tree
  from typing import Dict, List, Optional, Tuple, TYPE_CHECKING, Union
  from ray.rllib.env.base_env import _DUMMY_AGENT_ID
  from ray.rllib.evaluation.collectors.sample_collector import SampleCollector
  from ray.rllib.evaluation.collectors.agent_collector import AgentCollector
  from ray.rllib.evaluation.episode import Episode
  from ray.rllib.policy.policy import Policy
  from ray.rllib.policy.policy_map import PolicyMap
  from ray.rllib.policy.sample_batch import SampleBatch, MultiAgentBatch, concat_samples
  from ray.rllib.utils.annotations import override, PublicAPI
  from ray.rllib.utils.debug import summarize
  from ray.rllib.utils.framework import try_import_tf, try_import_torch
  from ray.rllib.utils.spaces.space_utils import get_dummy_batch_for_space
  from ray.rllib.utils.typing import AgentID, EpisodeID, EnvID, PolicyID, TensorType, ViewRequirementsDict
  from ray.util.debug import log_once
label_desc: Use image node_id 3 for calling the _PolicyCollector obj's underlying member method code with example usage: obj.build() and returns: batch