ray.rllib.utils.replay_buffers.multi_agent_replay_buffer.MultiAgentReplayBuffer.sample#

MultiAgentReplayBuffer.sample(num_items: int, policy_id: str | None = None, **kwargs) SampleBatch | MultiAgentBatch | Dict[str, Any] | None[source]#

Samples a MultiAgentBatch of num_items per one policy’s buffer.

If less than num_items records are in the policy’s buffer, some samples in the results may be repeated to fulfil the batch size num_items request. Returns an empty batch if there are no items in the buffer.

Parameters:
  • num_items – Number of items to sample from a policy’s buffer.

  • policy_id – ID of the policy that created the experiences we sample. If

  • given (none is)

  • policies. (sample from all)

Returns:

Concatenated MultiAgentBatch of items. **kwargs: Forward compatibility kwargs.

DeveloperAPI: This API may change across minor Ray releases.