class_docstr: A connector piece that adds previous rewards and actions to the input.
class_docstr_tok: ["A","connector","piece","that","adds","previous","rewards","and","actions","to","the","input","."]
docstr: Initializes a _PrevRewardPrevActionConnector instance.
  
  Args:
      n_prev_actions: The number of previous actions to include in the output
          data. Discrete actions are ont-hot'd. If > 1, will concatenate the
          individual action tensors.
      n_prev_rewards: The number of previous rewards to include in the output
          data.
      as_learner_connector: Whether this connector is part of a Learner connector
          pipeline, as opposed to a env-to-module pipeline.
docstr_tok: ["Initializes","a","_PrevRewardPrevActionConnector","instance",".","Args",":","n_prev_actions",":","The","number","of","previous","actions","to","include","in","the","output","data",".","Discrete","actions","are","ont-hot","'d",".","If",">","1",",","will","concatenate","the","individual","action","tensors",".","n_prev_rewards",":","The","number","of","previous","rewards","to","include","in","the","output","data",".","as_learner_connector",":","Whether","this","connector","is","part","of","a","Learner","connector","pipeline",",","as","opposed","to","a","env-to-module","pipeline","."]
code: def __init__(
      self,
      *,
      # Base class constructor args.
      input_observation_space: gym.Space,
      input_action_space: gym.Space,
      # Specific prev. r/a args.
      n_prev_actions: int = 1,
      n_prev_rewards: int = 1,
      as_learner_connector: bool = False,
      **kwargs,
  ):
      """Initializes a _PrevRewardPrevActionConnector instance.
  
      Args:
          n_prev_actions: The number of previous actions to include in the output
              data. Discrete actions are ont-hot'd. If > 1, will concatenate the
              individual action tensors.
          n_prev_rewards: The number of previous rewards to include in the output
              data.
          as_learner_connector: Whether this connector is part of a Learner connector
              pipeline, as opposed to a env-to-module pipeline.
      """
      super().__init__(
          input_observation_space=input_observation_space,
          input_action_space=input_action_space,
          **kwargs,
      )
  
      self.n_prev_actions = n_prev_actions
      self.n_prev_rewards = n_prev_rewards
      self.as_learner_connector = as_learner_connector
  
file_path: ray/rllib/connectors/env_to_module/prev_action_prev_reward.py
imports: from functools import partial
  import numpy
  from typing import Any, List, Optional
  import gymnasium
  from ray.rllib.connectors.connector_v2 import ConnectorV2
  from ray.rllib.core.rl_module.rl_module import RLModule
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.utils.annotations import override
  from ray.rllib.utils.spaces.space_utils import batch
  from ray.rllib.utils.typing import EpisodeType
label_desc: Use image node_id 1 to create a new _PrevRewardPrevActionConnector object from inherited base classes: ConnectorV2 with example: obj = _PrevRewardPrevActionConnector()