Skip to content

Commit

Permalink
Add an attempt at concatenate create_empty_array for OneOf?
Browse files Browse the repository at this point in the history
  • Loading branch information
RedTachyon committed Dec 5, 2023
1 parent 31061a5 commit 60eb634
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gymnasium/vector/utils/space_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ def _concatenate_dict(
@concatenate.register(Text)
@concatenate.register(Sequence)
@concatenate.register(Space)
@concatenate.register(OneOf)
def _concatenate_custom(space: Space, items: Iterable, out: None) -> tuple[Any, ...]:
return tuple(items)

Expand Down Expand Up @@ -413,6 +414,11 @@ def _create_empty_array_sequence(
return tuple(tuple() for _ in range(n))


@create_empty_array.register(OneOf)
def _create_empty_array_oneof(space: OneOf, n: int = 1, fn=np.zeros):
return tuple(tuple() for _ in range(n))


@create_empty_array.register(Space)
def _create_empty_array_custom(space, n=1, fn=np.zeros):
return None

0 comments on commit 60eb634

Please sign in to comment.