facebookresearch / mbrl-lib

Library for Model Based RL
MIT License
952 stars 154 forks source link

DQN agent for an environment with continuous actions #155

Closed MishraIN closed 2 years ago

MishraIN commented 2 years ago

I am trying to implement DQN using the continuous cartpole which came packaged with MBRL pets. When I am trying to discretized and flattened the action space I am getting error "AttributeError: 'float' object has no attribute 'squeeze'" in the last line of the code,

env= cartpole_env.CartPoleEnv()
import space_wrappers
wrapped = space_wrappers.DiscretizedActionWrapper(env, 2)
env = space_wrappers.FlattenedActionWrapper(wrapped)
env.reset()
env.step(1)
luisenp commented 2 years ago

Hi @MishraIN, my apologies for the delay, somehow I missed this message. step() method expects a numpy array, not a float.