rlworkgroup / garage

A toolkit for reproducible reinforcement learning research.
MIT License
1.84k stars 309 forks source link

akro.Discrete() return randomly. #2295

Closed tianyma closed 2 years ago

tianyma commented 2 years ago

Hi, I want to use discrete action space self._action_space = akro.Discrete(4) but I cannot get a discrete number in the step function, I got a list of 4 float type numbers, I am confused, can someone help me?

krzentner commented 2 years ago

In most of garage, we pass around "flattened" representations of observations and actions. For a discrete space, the flattened form is a one-hot encoding of the integer number. You should be able to convert it back to a number using self._action_space.unflatten(action) in this case.

I do recognize that this is confusing, and that it would probably be best if our core datatypes used unflattened data instead of flattened data.

tianyma commented 2 years ago

Thank you for your reply, that works.