From 2fcf8f91c1fa07bbdd920a27b3874e67997ad754 Mon Sep 17 00:00:00 2001 From: TibiGG <28602860+TibiGG@users.noreply.github.com> Date: Mon, 9 May 2022 12:36:15 +0100 Subject: [PATCH] Removed redundant double-check of nested Dict (#908) * Removed redundant double-check of nested Dict observation space from BaseAlgorithm * Update changelog Co-authored-by: tibigg --- docs/misc/changelog.rst | 3 ++- stable_baselines3/common/base_class.py | 5 ----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/docs/misc/changelog.rst b/docs/misc/changelog.rst index d8b6d6d..4bcecc4 100644 --- a/docs/misc/changelog.rst +++ b/docs/misc/changelog.rst @@ -33,6 +33,7 @@ Deprecations: Others: ^^^^^^^ - Upgraded to Python 3.7+ syntax using ``pyupgrade`` +- Removed redundant double-check for nested observations from ``BaseAlgorithm._wrap_env`` (@TibiGG) Documentation: ^^^^^^^^^^^^^^ @@ -970,4 +971,4 @@ And all the contributors: @wkirgsn @AechPro @CUN-bjy @batu @IljaAvadiev @timokau @kachayev @cleversonahum @eleurent @ac-93 @cove9988 @theDebugger811 @hsuehch @Demetrio92 @thomasgubler @IperGiove @ScheiklP @simoninithomas @armandpl @manuel-delverme @Gautam-J @gianlucadecola @buoyancy99 @caburu @xy9485 -@Gregwar @ycheng517 @quantitative-technologies @bcollazo @git-thor +@Gregwar @ycheng517 @quantitative-technologies @bcollazo @git-thor @TibiGG diff --git a/stable_baselines3/common/base_class.py b/stable_baselines3/common/base_class.py index 14570be..bdba909 100644 --- a/stable_baselines3/common/base_class.py +++ b/stable_baselines3/common/base_class.py @@ -209,11 +209,6 @@ class BaseAlgorithm(ABC): # Make sure that dict-spaces are not nested (not supported) check_for_nested_spaces(env.observation_space) - if isinstance(env.observation_space, gym.spaces.Dict): - for space in env.observation_space.spaces.values(): - if isinstance(space, gym.spaces.Dict): - raise ValueError("Nested observation spaces are not supported (Dict spaces inside Dict space).") - if not is_vecenv_wrapped(env, VecTransposeImage): wrap_with_vectranspose = False if isinstance(env.observation_space, gym.spaces.Dict):