Skip to content

Commit 175202f

Browse files
authored
Allow frame stack size of 1 in FrameStack wrapper (#1192)
1 parent 259aa6a commit 175202f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

gymnasium/wrappers/stateful_observation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,9 @@ def __init__(
372372
raise TypeError(
373373
f"The stack_size is expected to be an integer, actual type: {type(stack_size)}"
374374
)
375-
if not 1 < stack_size:
375+
if not 0 < stack_size:
376376
raise ValueError(
377-
f"The stack_size needs to be greater than one, actual value: {stack_size}"
377+
f"The stack_size needs to be greater than zero, actual value: {stack_size}"
378378
)
379379
if isinstance(padding_type, str) and (
380380
padding_type == "reset" or padding_type == "zero"

tests/wrappers/test_frame_stack_observation.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,11 @@ def test_stack_size_failures():
134134

135135
with pytest.raises(
136136
ValueError,
137-
match=re.escape("The stack_size needs to be greater than one, actual value: 1"),
137+
match=re.escape(
138+
"The stack_size needs to be greater than zero, actual value: 0"
139+
),
138140
):
139-
FrameStackObservation(env, stack_size=1)
141+
FrameStackObservation(env, stack_size=0)
140142

141143
with pytest.raises(
142144
ValueError,

0 commit comments

Comments
 (0)