qgym.spaces.dict module
This module contains the Dict
space, i.e., a dictionary with fixed strings as
keys and spaces as values.
- Usage:
>>> from qgym.spaces import Box, Dict >>> box1 = Box(low=0, high=20, shape=(2, 3), dtype=int) >>> box2 = Box(low=-5, high=1, shape=(3, 2), dtype=float) >>> Dict(box1=box1, box2=box2) Dict(box1:Box([[0 0 0] [0 0 0]], [[20 20 20] [20 20 20]], (2, 3), int32), box2:Box([[-5. -5.] [-5. -5.] [-5. -5.]], [[1. 1.] [1. 1.] [1. 1.]], (3, 2), float64))
- class qgym.spaces.dict.Dict(spaces=None, *, rng=None, **spaces_kwargs)[source]
Bases:
Dict
Dictionary of other action/observation spaces for use in RL environments.
- __init__(spaces=None, *, rng=None, **spaces_kwargs)[source]
Initialize a
Dict
space, with string valued keys and spaces inheriting fromgym.Space
as values.- Parameters:
spaces (
dict
[str
,Space
[Any
]] |Sequence
[tuple
[str
,Space
[Any
]]] |None
) – Dictionary containing string valued keys and spaces that are to formspace. (this Dict)
rng (
Generator
|None
) – Random number generator to be used in this space, ifNone
a new one will be constructed.spaces_kwargs (
Space
[Any
]) – Spaces that are to form thisDict
space.