ray.rllib.policy.sample_batch.MultiAgentBatch.wrap_as_needed#

static MultiAgentBatch.wrap_as_needed(policy_batches: Dict[str, SampleBatch], env_steps: int) SampleBatch | MultiAgentBatch[source]#

Returns SampleBatch or MultiAgentBatch, depending on given policies. If policy_batches is empty (i.e. {}) it returns an empty MultiAgentBatch.

Parameters:
  • policy_batches – Mapping from policy ids to SampleBatch.

  • env_steps – Number of env steps in the batch.

Returns:

The single default policy’s SampleBatch or a MultiAgentBatch (more than one policy).