mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-23 15:04:20 +00:00
Add probability masking to space.sample
(#1310)
Co-authored-by: Mario Jerez <jerezmario1@gmail.com>
This commit is contained in:
@@ -373,3 +373,15 @@ def test_sample_mask():
|
||||
match=re.escape("Box.sample cannot be provided a mask, actual value: "),
|
||||
):
|
||||
space.sample(mask=np.array([0, 1, 0], dtype=np.int8))
|
||||
|
||||
|
||||
def test_sample_probability_mask():
|
||||
"""Box cannot have a probability mask applied."""
|
||||
space = Box(0, 1)
|
||||
with pytest.raises(
|
||||
gym.error.Error,
|
||||
match=re.escape(
|
||||
"Box.sample cannot be provided a probability mask, actual value: "
|
||||
),
|
||||
):
|
||||
space.sample(probability=np.array([0, 1, 0], dtype=np.float64))
|
||||
|
Reference in New Issue
Block a user