kengz / SLM-Lab

Modular Deep Reinforcement Learning framework in PyTorch. Companion library of the book "Foundations of Deep Reinforcement Learning".
https://slm-lab.gitbook.io/slm-lab/
MIT License
1.25k stars 266 forks source link

I have encounter one problem, maybe a bug. #506

Closed dvstter closed 2 years ago

dvstter commented 2 years ago

I've designed a MultiDiscrete observation and action space. But when I employ DDQN on this environment, the compiler tells me that 'assert len(in_dim) == 3' wrong in 'net/conv.py'. I found that the in_dim is 3, which is an integer. The problem seems happen in function '_get_observable_dim(self, observation_space)' in 'env/base.py'. The observation_space.shape will not return the actual shape, but the dim when the environment is MultiDiscrete. Another verification is that in function '_get_action_dim', action_dim is processed in this way, which is 'action_space.nvec.tolist()'. So I change put two lines of code below if instance(observation_space, spaces.MultiDiscrete): state_dim = observation_sapce.nvec.tolist() in line 145-146 in file env/base.py. A8B6CD68EC4E12E572A1DFF4395202FB

kengz commented 2 years ago

Hi @dvstter thanks for the ticket. Would you mind opening a pull request to add those 2 lines of code?