ray.rllib.policy.sample_batch.SampleBatch.shuffle#

SampleBatch.shuffle() SampleBatch[source]#

Shuffles the rows of this batch in-place.

Returns:

This very (now shuffled) SampleBatch.

Raises:

ValueError – If self[SampleBatch.SEQ_LENS] is defined.

from ray.rllib.policy.sample_batch import SampleBatch
batch = SampleBatch({"a": [1, 2, 3, 4]})
print(batch.shuffle())
{"a": [4, 1, 3, 2]}