Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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