diff --git a/tianshou/policy/base.py b/tianshou/policy/base.py index 19bc58dea..2cd0fbd7c 100644 --- a/tianshou/policy/base.py +++ b/tianshou/policy/base.py @@ -138,7 +138,8 @@ def map_action(self, act: Union[Batch, np.ndarray]) -> Union[Batch, np.ndarray]: :return: action in the same form of input "act" but remap to the target action space. """ - if isinstance(self.action_space, gym.spaces.Box): + if isinstance(self.action_space, gym.spaces.Box) and \ + isinstance(act, np.ndarray): # currently this action mapping only supports np.ndarray action if self.action_bound_method == "clip": act = np.clip(act, -1, 1)