Allow sequence to accept stacked np arrays if the feature space is Box (#241)

This commit is contained in:
Jet
2023-01-05 20:46:37 +00:00
committed by GitHub
parent 82b839fcd1
commit c2a387702c
2 changed files with 11 additions and 1 deletions

View File

@@ -119,7 +119,8 @@ class Sequence(Space[typing.Tuple[Any, ...]]):
def contains(self, x: Any) -> bool:
"""Return boolean specifying if x is a valid member of this space."""
return isinstance(x, collections.abc.Sequence) and all(
# by definition, any sequence is an iterable
return isinstance(x, collections.abc.Iterable) and all(
self.feature_space.contains(item) for item in x
)