ray.rllib.policy.sample_batch.SampleBatch.concat#

SampleBatch.concat(other: SampleBatch) SampleBatch[source]#

Concatenates other to this one and returns a new SampleBatch.

Parameters:

other – The other SampleBatch object to concat to this one.

Returns:

The new SampleBatch, resulting from concating other to self.

import numpy as np
from ray.rllib.policy.sample_batch import SampleBatch
b1 = SampleBatch({"a": np.array([1, 2])})
b2 = SampleBatch({"a": np.array([3, 4, 5])})
print(b1.concat(b2))
{"a": np.array([1, 2, 3, 4, 5])}