ray.rllib.policy.sample_batch.SampleBatch.rows
ray.rllib.policy.sample_batch.SampleBatch.rows#
- SampleBatch.rows() Iterator[Dict[str, Union[numpy.array, jnp.ndarray, tf.Tensor, torch.Tensor]]] [source]#
Returns an iterator over data rows, i.e. dicts with column values.
Note that if
seq_lens
is set in self, we set it to 1 in the rows.- Yields
The column values of the row in this iteration.
Examples
>>> from ray.rllib.policy.sample_batch import SampleBatch >>> batch = SampleBatch({ ... "a": [1, 2, 3], ... "b": [4, 5, 6], ... "seq_lens": [1, 2] ... }) >>> for row in batch.rows(): ... print(row) {"a": 1, "b": 4, "seq_lens": 1} {"a": 2, "b": 5, "seq_lens": 1} {"a": 3, "b": 6, "seq_lens": 1}