1
0
mirror of https://github.com/gryf/coach.git synced 2025-12-17 19:20:19 +01:00

Add tensor input type for arbitrary dimensional observation (#125)

* Allow arbitrary dimensional observation (non vector or image)
* Added creating PlanarMapsObservationSpace to GymEnvironment when number of channels is not 1 or 3
This commit is contained in:
Sina Afrooze
2018-11-19 06:41:12 -08:00
committed by Gal Leibovich
parent 7ba1a4393f
commit 67a90ee87e
10 changed files with 194 additions and 24 deletions

View File

@@ -183,7 +183,7 @@ class ObservationSpace(Space):
class VectorObservationSpace(ObservationSpace):
"""
An observation space which is defined as a vector of elements. This can be particularly useful for environments
which return measurements, such as in robotic environmnets.
which return measurements, such as in robotic environments.
"""
def __init__(self, shape: int, low: Union[None, int, float, np.ndarray]=-np.inf,
high: Union[None, int, float, np.ndarray]=np.inf, measurements_names: List[str]=None):
@@ -197,6 +197,16 @@ class VectorObservationSpace(ObservationSpace):
super().__init__(shape, low, high)
class TensorObservationSpace(ObservationSpace):
"""
An observation space which defines observations with arbitrary shape. This can be particularly useful for
environments with non image input.
"""
def __init__(self, shape: np.ndarray, low: -np.inf,
high: np.inf):
super().__init__(shape, low, high)
class PlanarMapsObservationSpace(ObservationSpace):
"""
An observation space which defines a stack of 2D observations. For example, an environment which returns