Skip to content

Fix multi thread env state in case N=1#968

Open
johannes-fischer wants to merge 1 commit intoJuliaReinforcementLearning:mainfrom
johannes-fischer:fix_multi_thread_env_state
Open

Fix multi thread env state in case N=1#968
johannes-fischer wants to merge 1 commit intoJuliaReinforcementLearning:mainfrom
johannes-fischer:fix_multi_thread_env_state

Conversation

@johannes-fischer
Copy link
Contributor

@johannes-fischer johannes-fischer commented Aug 24, 2023

I have come across an issue with MultiThreadEnv for an environment where the state_space(envs[1]= is not a Space. The error message is

ERROR: DimensionMismatch: cannot broadcast array to have fewer non-singleton dimensions

because selectdim(menv.states, N, i) in this case returned a
0-dimensional view(::Vector{Vector{Float64}}, 1) with eltype Vector{Float64}.

I belief this change should fix the problem.

PR Checklist

  • Update NEWS.md?
  • Unit tests for all structs / functions?
  • Integration and correctness tests using a simple env?
  • PR Review?
  • Add or update documentation?
  • Write docstrings for new methods?

@jeremiahpslewis
Copy link
Member

Thanks for catching this! Can you add a test which catches this issue?

@johannes-fischer
Copy link
Contributor Author

Is there an environment where the state space is not a Space? The one I am using is not suitable for a test. Unfortunately, there seem to be no other tests to adapt.

@jeremiahpslewis
Copy link
Member

Can you create a minimal custom env extending AbstractEnv?

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

Successfully merging this pull request may close these issues.

2 participants