Skip to content

Commit

Permalink
[RLlib] Fix assertion in Simplex space. (ray-project#47880)
Browse files Browse the repository at this point in the history
Signed-off-by: ujjawal-khare <[email protected]>
  • Loading branch information
simonsays1980 authored and ujjawal-khare committed Oct 15, 2024
1 parent 960e28d commit 0224d7b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions rllib/utils/spaces/simplex.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def __init__(self, shape, concentration=None, dtype=np.float32):

if concentration is not None:
assert (
concentration.shape == shape[:-1]
), f"{concentration.shape} vs {shape[:-1]}"
concentration.shape[0] == shape[-1]
), f"{concentration.shape[0]} vs {shape[-1]}"
self.concentration = concentration
else:
self.concentration = np.array([1] * self.dim)
Expand Down
2 changes: 1 addition & 1 deletion rllib/utils/tests/test_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def test_dict_space_with_ordered_dict(self):
self.assertTrue(input_space == deserialized_space)

def test_simplex_space(self):
space = Simplex(shape=(3, 4), concentration=np.array((1, 2, 1)))
space = Simplex(shape=(3, 4), concentration=np.array((1, 2, 1, 2)))

d = gym_space_to_dict(space)
sp = gym_space_from_dict(d)
Expand Down

0 comments on commit 0224d7b

Please sign in to comment.