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: Initializes a _PolicyCollector instance.
  
  Args:
      policy: The policy object.
code: def __init__(self, policy: Policy):
      """Initializes a _PolicyCollector instance.
  
      Args:
          policy: The policy object.
      """
  
      self.batches = []
      self.policy = policy
      # The total timestep count for all agents that use this policy.
      # NOTE: This is not an env-step count (across n agents). AgentA and
      # agentB, both using this policy, acting in the same episode and both
      # doing n steps would increase the count by 2*n.
      self.agent_steps = 0
  
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 1 to create a new _PolicyCollector object  with example: obj = _PolicyCollector(policy)