duckietown / gym-duckietown

Self-driving car simulator for the Duckietown universe
http://duckietown.org
Other
51 stars 19 forks source link

Fixing dimension issues #62

Closed nithin127 closed 6 years ago

nithin127 commented 6 years ago

I was getting the following o = env.reset(); o.shape Result: (3, 120, 160)

env.observation_space Result: Box(3,160,120)

So I made some changes.. hope these are consistent with the rest of the code

maximecb commented 6 years ago

You should provide a little more context about what you were trying to do, and where in the program you put those print statements. I added some new tests, and everything seems fine on my end:

https://github.com/duckietown/gym-duckietown/blob/master/run_tests.py#L19

maximecb commented 6 years ago

I repatriated the PyTorch observation wrapper into the gym-duckietown codebase so we can use it with other RL code, and added tests:

https://github.com/duckietown/gym-duckietown/blob/master/gym_duckietown/wrappers.py#L30

nithin127 commented 6 years ago

So, I'm trying to run python main.py on https://github.com/nithin127/pytorch-a2c-ppo-acktr

And I get the following error: Traceback (most recent call last): File "main.py", line 224, in <module> main() File "main.py", line 112, in main update_current_obs(obs) File "main.py", line 109, in update_current_obs current_obs[:, -shape_dim0:] = obs RuntimeError: The expanded size of the tensor (120) must match the existing size (160) at non-singleton dimension 3

Basically; obs.shape gives (8, 3, 120, 160) env.observation_space gives Box(3, 160, 120)

The changes I made were giving the env.observation_space gives Box(3, 120, 160) Which made sure there was no error..

maximecb commented 6 years ago

So, I've added tests, and this is not the result I get on my end: https://github.com/duckietown/gym-duckietown/blob/master/run_tests.py#L24

Which version of Python and which version of PyTorch are you running?