class_docstr: Collects samples for one agent in one trajectory (episode).
  
  The agent may be part of a multi-agent environment. Samples are stored in
  lists including some possible automatic "shift" buffer at the beginning to
  be able to save memory when storing things like NEXT_OBS, PREV_REWARDS,
  etc.., which are specified using the trajectory view API.
class_docstr_tok: ["Collects","samples","for","one","agent","in","one","trajectory","(","episode",")",".","The","agent","may","be","part","of","a","multi-agent","environment",".","Samples","are","stored","in","lists","including","some","possible","automatic","``","shift","''","buffer","at","the","beginning","to","be","able","to","save","memory","when","storing","things","like","NEXT_OBS",",","PREV_REWARDS",",","etc","..",",","which","are","specified","using","the","trajectory","view","API","."]
docstr: Fills the buffer with the initial values for the given data column.
  for dat_col starting with `state_out`, use the initial states of the policy,
  but for other data columns, create a dummy value based on the view requirement
  space.
  
  Args:
      data_col: The data column to fill the buffer with.
      view_requirement: The view requirement for the view_col. Normally the view
          requirement for the data column is used and if it does not exist for
          some reason the view requirement for view column is used instead.
      build_for_inference: Whether this is getting called for inference or not.
  
  returns:
      is_state: True if the data_col is an RNN state, False otherwise.
docstr_tok: ["Fills","the","buffer","with","the","initial","values","for","the","given","data","column",".","for","dat_col","starting","with","`","state_out","`",",","use","the","initial","states","of","the","policy",",","but","for","other","data","columns",",","create","a","dummy","value","based","on","the","view","requirement","space",".","Args",":","data_col",":","The","data","column","to","fill","the","buffer","with",".","view_requirement",":","The","view","requirement","for","the","view_col",".","Normally","the","view","requirement","for","the","data","column","is","used","and","if","it","does","not","exist","for","some","reason","the","view","requirement","for","view","column","is","used","instead",".","build_for_inference",":","Whether","this","is","getting","called","for","inference","or","not",".","returns",":","is_state",":","True","if","the","data_col","is","an","RNN","state",",","False","otherwise","."]
code: def _fill_buffer_with_initial_values(
      self,
      data_col: str,
      view_requirement: ViewRequirement,
      build_for_inference: bool = False,
  ) -> bool:
      """Fills the buffer with the initial values for the given data column.
      for dat_col starting with `state_out`, use the initial states of the policy,
      but for other data columns, create a dummy value based on the view requirement
      space.
  
      Args:
          data_col: The data column to fill the buffer with.
          view_requirement: The view requirement for the view_col. Normally the view
              requirement for the data column is used and if it does not exist for
              some reason the view requirement for view column is used instead.
          build_for_inference: Whether this is getting called for inference or not.
  
      returns:
          is_state: True if the data_col is an RNN state, False otherwise.
      """
      try:
          space = self.view_requirements[data_col].space
      except KeyError:
          space = view_requirement.space
  
      # special treatment for state_out
      # add them to the buffer in case they don't exist yet
      is_state = True
      if data_col.startswith("state_out"):
          if self._enable_new_api_stack:
              self._build_buffers({data_col: self.initial_states})
          else:
              if not self.is_policy_recurrent:
                  raise ValueError(
                      f"{data_col} is not available, because the given policy is"
                      f"not recurrent according to the input model_inital_states."
                      f"Have you forgotten to return non-empty lists in"
                      f"policy.get_initial_states()?"
                  )
              state_ind = int(data_col.split("_")[-1])
              self._build_buffers(
                  {data_col: self.initial_states[state_ind]}
              )
      else:
          is_state = False
          # only create dummy data during inference
          if build_for_inference:
              if isinstance(space, Space):
                  #  state_out assumes the values do not have a batch dimension
                  #  (i.e. instead of being (1, d) it is of shape (d,).
                  fill_value = get_dummy_batch_for_space(
                      space,
                      batch_size=0,
                  )
              else:
                  fill_value = space
  
              self._build_buffers({data_col: fill_value})
  
      return is_state
  
imports: import copy
  import logging
  import math
  from typing import Any, Dict, List, Optional
  import numpy
  import tree
  from gymnasium.spaces import Space
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.policy.view_requirement import ViewRequirement
  from ray.rllib.utils.framework import try_import_torch
  from ray.rllib.utils.spaces.space_utils import flatten_to_single_ndarray, get_dummy_batch_for_space
  from ray.rllib.utils.typing import EpisodeID, EnvID, TensorType, ViewRequirementsDict
  from ray.util.annotations import PublicAPI
label_desc: Use image node_id 13 for calling the AgentCollector obj's underlying member method code with example usage: obj._fill_buffer_with_initial_values(data_col, view_requirement, build_for_inference) and returns: is_state