MCPcopy Index your code
hub / github.com/ddbourgin/numpy-ml / is_tuple

Function is_tuple

numpy_ml/rl_models/rl_utils.py:231–254  ·  view source on GitHub ↗

Check if the action and observation spaces for `env` are instances of ``gym.spaces.Tuple`` or ``gym.spaces.Dict``. Notes ----- A tuple space is a tuple of *several* (possibly multidimensional) action/observation spaces. For our purposes, a tuple space is necessarily mul

(env)

Source from the content-addressed store, hash-verified

229
230
231def is_tuple(env):
232 """
233 Check if the action and observation spaces for `env` are instances of
234 ``gym.spaces.Tuple`` or ``gym.spaces.Dict``.
235
236 Notes
237 -----
238 A tuple space is a tuple of *several* (possibly multidimensional)
239 action/observation spaces. For our purposes, a tuple space is necessarily
240 multidimensional.
241
242 Returns
243 -------
244 tuple_action : bool
245 Whether the `env`'s action space is an instance of ``gym.spaces.Tuple``
246 or ``gym.spaces.Dict``.
247 tuple_obs : bool
248 Whether the `env`'s observation space is an instance of
249 ``gym.spaces.Tuple`` or ``gym.spaces.Dict``.
250 """
251 tuple_space, dict_space = gym.spaces.Tuple, gym.spaces.dict.Dict
252 tuple_action = isinstance(env.action_space, (tuple_space, dict_space))
253 tuple_obs = isinstance(env.observation_space, (tuple_space, dict_space))
254 return tuple_action, tuple_obs
255
256
257def is_multidimensional(env):

Callers 1

is_multidimensionalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected