docstr: Get the initial input_dict to be passed into compute_single_action.
  
  Args:
      observation: first (unbatched) observation from env.reset()
  
  Returns:
      The input_dict for inference: {
          OBS: [max_seq_len, obs_dim] array,
          ACTIONS: [max_seq_len - 1, act_dim] array,
          RETURNS_TO_GO: [max_seq_len - 1] array,
          REWARDS: scalar,
          TIMESTEPS: [max_seq_len - 1] array,
      }
      Note the sequence lengths are different, and is specified as per
      view_requirements. Explanations in action_distribution_fn method.
docstr_tok: ["Get","the","initial","input_dict","to","be","passed","into","compute_single_action",".","Args",":","observation",":","first","(","unbatched",")","observation","from","env.reset","(",")","Returns",":","The","input_dict","for","inference",":","{","OBS",":","[","max_seq_len",",","obs_dim","]","array",",","ACTIONS",":","[","max_seq_len","-","1",",","act_dim","]","array",",","RETURNS_TO_GO",":","[","max_seq_len","-","1","]","array",",","REWARDS",":","scalar",",","TIMESTEPS",":","[","max_seq_len","-","1","]","array",",","}","Note","the","sequence","lengths","are","different",",","and","is","specified","as","per","view_requirements",".","Explanations","in","action_distribution_fn","method","."]
code: def get_initial_input_dict(
      self, observation: TensorStructType
  ) -> SampleBatch:
      """Get the initial input_dict to be passed into compute_single_action.
  
      Args:
          observation: first (unbatched) observation from env.reset()
  
      Returns:
          The input_dict for inference: {
              OBS: [max_seq_len, obs_dim] array,
              ACTIONS: [max_seq_len - 1, act_dim] array,
              RETURNS_TO_GO: [max_seq_len - 1] array,
              REWARDS: scalar,
              TIMESTEPS: [max_seq_len - 1] array,
          }
          Note the sequence lengths are different, and is specified as per
          view_requirements. Explanations in action_distribution_fn method.
      """
      observation = convert_to_numpy(observation)
      obs_shape = observation.shape
      obs_dtype = observation.dtype
  
      act_shape = self.action_space.shape
      act_dtype = self.action_space.dtype
  
      # Here we will pad all the required inputs to its proper sequence length
      # as their ViewRequirement.
  
      observations = np.concatenate(
          [
              np.zeros(
                  (self.max_seq_len - 1, *obs_shape), dtype=obs_dtype
              ),
              observation[None],
          ],
          axis=0,
      )
  
      actions = np.zeros(
          (self.max_seq_len - 1, *act_shape), dtype=act_dtype
      )
  
      rtg = np.zeros(self.max_seq_len - 1, dtype=np.float32)
  
      rewards = np.zeros((), dtype=np.float32)
  
      # -1 for masking in action_distribution_fn
      timesteps = np.full(
          self.max_seq_len - 1, fill_value=-1, dtype=np.int32
      )
  
      input_dict = SampleBatch(
          {
              SampleBatch.OBS: observations,
              SampleBatch.ACTIONS: actions,
              SampleBatch.RETURNS_TO_GO: rtg,
              SampleBatch.REWARDS: rewards,
              SampleBatch.T: timesteps,
          }
      )
      return input_dict
  
imports: from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Type, Union
  import gymnasium
  import numpy
  import tree
  from gymnasium.spaces import Box, Discrete
  from rllib_dt.dt.dt_torch_model import DTTorchModel
  from ray.rllib.models.catalog import ModelCatalog
  from ray.rllib.models.modelv2 import ModelV2
  from ray.rllib.models.torch.mingpt import configure_gpt_optimizer
  from ray.rllib.models.torch.torch_action_dist import TorchCategorical, TorchDeterministic, TorchDistributionWrapper
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.policy.torch_mixins import LearningRateSchedule
  from ray.rllib.policy.torch_policy_v2 import TorchPolicyV2
  from ray.rllib.utils.annotations import DeveloperAPI, PublicAPI, override
  from ray.rllib.utils.framework import try_import_torch
  from ray.rllib.utils.numpy import convert_to_numpy
  from ray.rllib.utils.threading import with_lock
  from ray.rllib.utils.torch_utils import apply_grad_clipping
  from ray.rllib.utils.typing import TensorShape, TensorStructType, TensorType, TrainerConfigDict
label_desc: Use image node_id 5 for calling the DTTorchPolicy obj's underlying member method code with example usage: obj.get_initial_input_dict(observation) and returns: input_dict