ray.rllib.policy.sample_batch.SampleBatch.get_single_step_input_dict#

SampleBatch.get_single_step_input_dict(view_requirements: Dict[str, ViewRequirement], index: str | int = 'last') SampleBatch[source]#

Creates single ts SampleBatch at given index from self.

For usage as input-dict for model (action or value function) calls.

Parameters:
  • view_requirements – A view requirements dict from the model for which to produce the input_dict.

  • index – An integer index value indicating the position in the trajectory for which to generate the compute_actions input dict. Set to “last” to generate the dict at the very end of the trajectory (e.g. for value estimation). Note that “last” is different from -1, as “last” will use the final NEXT_OBS as observation input.

Returns:

The (single-timestep) input dict for ModelV2 calls.