rl-pendulum icon indicating copy to clipboard operation
rl-pendulum copied to clipboard

variable dimension issue

Open salman-qadir opened this issue 1 year ago • 1 comments

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)

salman-qadir avatar Jul 26 '23 08:07 salman-qadir

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)

Elstuhn avatar Jan 26 '24 01:01 Elstuhn