Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exercise 1.3 #144

Closed
wants to merge 2 commits into from
Closed

Fix exercise 1.3 #144

wants to merge 2 commits into from

Conversation

lbertge
Copy link

@lbertge lbertge commented Apr 18, 2019

Actions are interpreted as scalars. In NumPy this is represented as an array, but with one of its dimensions size 0. Here, we desire a vector with the shape (act_dim, ). In the get_action() method, the action is assigned to the result of sess.run(pi ...) which returns an vector with shape (act_dim, 1). We add the [0] here to remove the second dimension so it can be used properly. Without it, we can get an error, like the following:

> python exercise1_3.py --env RoboschoolHalfCheetah-v1
...
  File "/home/anaconda3/envs/spinningup/lib/python3.6/site-packages/roboschool/gym_forward_walker.py", line 43, in apply_action
    j.set_motor_torque( self.power*j.power_coef*float(np.clip(a[n], -1, +1)) )
TypeError: only size-1 arrays can be converted to Python scalars

@lbertge
Copy link
Author

lbertge commented Apr 18, 2019

Sorry, just noticed this is a duplicate of #106.

@lbertge lbertge closed this Apr 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant