|
|
|
|
|
|
assert specs.discrete_branches == () |
|
|
|
assert specs.discrete_size == 0 |
|
|
|
assert specs.continuous_size == 3 |
|
|
|
assert specs.create_empty(5).shape == (5, 3) |
|
|
|
assert specs.create_empty(5).dtype == np.float32 |
|
|
|
assert specs.empty_action(5).shape == (5, 3) |
|
|
|
assert specs.empty_action(5).dtype == np.float32 |
|
|
|
assert specs.create_empty(5).shape == (5, 1) |
|
|
|
assert specs.create_empty(5).dtype == np.int32 |
|
|
|
assert specs.empty_action(5).shape == (5, 1) |
|
|
|
assert specs.empty_action(5).dtype == np.int32 |
|
|
|
|
|
|
|
|
|
|
|
def test_action_generator(): |
|
|
|
|
|
|
zero_action = specs.create_empty(4) |
|
|
|
zero_action = specs.empty_action(4) |
|
|
|
random_action = specs.create_random(4) |
|
|
|
random_action = specs.random_action(4) |
|
|
|
assert random_action.dtype == np.float32 |
|
|
|
assert random_action.shape == (4, action_len) |
|
|
|
assert np.min(random_action) >= -1 |
|
|
|
|
|
|
action_shape = (10, 20, 30) |
|
|
|
specs = ActionSpec.create_discrete(action_shape) |
|
|
|
zero_action = specs.create_empty(4) |
|
|
|
zero_action = specs.empty_action(4) |
|
|
|
random_action = specs.create_random(4) |
|
|
|
random_action = specs.random_action(4) |
|
|
|
assert random_action.dtype == np.int32 |
|
|
|
assert random_action.shape == (4, len(action_shape)) |
|
|
|
assert np.min(random_action) >= 0 |