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

SampleBatch.concat(other: SampleBatch) SampleBatch[源代码]#

other 连接到当前对象并返回一个新的 SampleBatch。

参数:

other – 要与此对象连接的另一个 SampleBatch 对象。

返回:

新的 SampleBatch,由将 other 连接到 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])}