mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
19 lines
740 B
Python
19 lines
740 B
Python
from collections import namedtuple
|
|
from ray.rllib.utils.deprecation import deprecation_warning
|
|
|
|
|
|
# NOTE: This is a deprecated class. Use native python tuples
|
|
# or dicts (both arbitrarily nested) for multi-actions from here on.
|
|
class TupleActions(namedtuple("TupleActions", ["batches"])):
|
|
"""Used to return tuple actions as a list of batches per tuple element."""
|
|
|
|
def __new__(cls, batches):
|
|
# Throw an informative error if used.
|
|
deprecation_warning(
|
|
old="TupleActions",
|
|
new="`native python tuples (arbitrarily nested)`",
|
|
error=True)
|
|
return super(TupleActions, cls).__new__(cls, batches)
|
|
|
|
def numpy(self):
|
|
return TupleActions([b.numpy() for b in self.batches])
|