Exemplo n.º 1
0
    def observation_space(self):
        """Return the observation space.

        Returns:
            akro.Dict: Observation space.
        """
        return akro.Dict({
            'achieved_goal':
            akro.Box(low=-200., high=200., shape=(3, ), dtype=np.float32),
            'desired_goal':
            akro.Box(low=-200., high=200., shape=(3, ), dtype=np.float32),
            'observation':
            akro.Box(low=-200., high=200., shape=(25, ), dtype=np.float32)
        })
Exemplo n.º 2
0
def test_check_spec():
    with pytest.raises(ValueError, match='should be an akro.Box'):
        # Input space is not Box or Image
        _check_spec(InOutSpec(akro.Dict(), None), 'NCHW')
    with pytest.raises(ValueError, match='should have three dimensions'):
        # Too many input dimensions
        _check_spec(
            InOutSpec(akro.Box(shape=[1, 1, 1, 1], low=-np.inf, high=np.inf),
                      None), 'NCHW')
    with pytest.raises(ValueError, match='akro.Box with a single dimension'):
        # Output is not one-dimensional
        _check_spec(
            InOutSpec(akro.Box(shape=[1, 1, 1], low=-np.inf, high=np.inf),
                      akro.Box(
                          shape=[1, 1],
                          low=-np.inf,
                          high=np.inf,
                      )), 'NCHW')
    with pytest.warns(UserWarning):
        # 4 color channels should warn
        _check_spec(
            InOutSpec(akro.Box(shape=[4, 1, 1], low=-np.inf, high=np.inf),
                      None), 'NCHW')