From 77b5098e7d8735801a4a3dd822f4a16268d55e51 Mon Sep 17 00:00:00 2001 From: Eric Liang Date: Wed, 27 Nov 2019 12:57:38 -0800 Subject: [PATCH] [rllib] Warn about dict action spaces --- rllib/models/catalog.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rllib/models/catalog.py b/rllib/models/catalog.py index a8adb05c8..a43c7e372 100644 --- a/rllib/models/catalog.py +++ b/rllib/models/catalog.py @@ -170,6 +170,10 @@ class ModelCatalog(object): "supported for Pytorch.") return partial(MultiCategorical, input_lens=action_space.nvec), \ int(sum(action_space.nvec)) + elif isinstance(action_space, gym.spaces.Dict): + raise NotImplementedError( + "Dict action spaces are not supported, consider using " + "gym.spaces.Tuple instead") return dist, dist.required_model_output_shape(action_space, config) @@ -204,6 +208,10 @@ class ModelCatalog(object): all_discrete = False size += np.product(action_space.spaces[i].shape) return (tf.int64 if all_discrete else tf.float32, (None, size)) + elif isinstance(action_space, gym.spaces.Dict): + raise NotImplementedError( + "Dict action spaces are not supported, consider using " + "gym.spaces.Tuple instead") else: raise NotImplementedError("action space {}" " not supported".format(action_space))