stable-baselines icon indicating copy to clipboard operation
stable-baselines copied to clipboard

"Error: the action space must be a vector" error is not included in the env_checker

Open saeid93 opened this issue 5 years ago • 3 comments

The following assertion which checks if the action-space is a vector or not is not included in the env_checker script but returns an error during the runtime:

    if isinstance(ac_space, spaces.Box):
        assert len(ac_space.shape) == 1, "Error: the action space must be a vector"
        return DiagGaussianProbabilityDistributionType(ac_space.shape[0])

the mentioned is on common/distributions.py and def make_prob_dist_type(): function line 486-488.

saeid93 avatar Apr 18 '20 10:04 saeid93

Good catch. I would also update assertion to be more informative. It seems to make sure you do not use an Box space with multiple axis. I was bit confused about "must being a vector", and thought it checks if the shape is scalar.

A PR to add this and update env_checker would be welcomed :)

Miffyli avatar Apr 18 '20 10:04 Miffyli

A PR to add this and update env_checker would be welcomed :)

It would be a warning as it is specific to Stable Baselines. But yes, I forgot that one.

araffin avatar Apr 18 '20 19:04 araffin

@Miffyli @araffin sure! I will add the PR.

saeid93 avatar Apr 18 '20 20:04 saeid93