Skip to content

Unify API for actions and observations

Michael Lutter requested to merge unify_api into master


students told me that our API is not consistent for observations and actions. So I unified the checks for actions on all environments (at least to the best of my knowledge). So every environment checks the action via:

assert a is not None, "Action should be not None"
assert isinstance(a,np.ndarray), "The action should be a ndarray"
assert np.all(not np.isnan(a)), "Action NaN is not a valid action"
assert a.ndim == 1, "The action = {1} must be 1d but the input is {0:d}d".format(a.ndim, a)

In addition, the observation is now guaranteed to be an np.array. You can test this by running the python script

@muratore @abdulsamad @belousov @tosatto Are you ok with that? If nobody complains, I will merge it to master. And sorry that I made such a mess with the commits.

Merge request reports