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

variable dimension issue #1

Open
salman-qadir opened this issue Jul 26, 2023 · 1 comment
Open

variable dimension issue #1

salman-qadir opened this issue Jul 26, 2023 · 1 comment

Comments

@salman-qadir
Copy link

File "e:\python\cod\codes\rl-pendulum\Pendulum_DQN\pendulum_dqn.py", line 155, in
action, real_action, count = agent.choose_action(torch.FloatTensor(state))
^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: expected sequence of length 3 at dim 1 (got 0)

@Elstuhn
Copy link

Elstuhn commented Jan 26, 2024

To fix this, go to line 149 and change it from
state = env.reset() to state, _ = env.reset()
This code is according to old gym and does not account for new gym

You'll likely encounter another problem at line 156 as well,
change any instance of state_prime, reward, done, _ = env.step([real_action]) to state_prime, reward, done, truncated, _ = env.step([real_action])
and then change at line 153 from while not done to while not (done or truncated)

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

No branches or pull requests

2 participants