def _init_space(self, space):
if not isinstance(space, gym.Space):
raise ValueError("Unknown space, type '%s'" % type(space))
elif isinstance(space, gym.spaces.Box):
n_dims = np.product(space.shape)
handler = BoxClipHandler(space.low, space.high)
elif isinstance(space, gym.spaces.Discrete):
n_dims = 1
handler = IntHandler(space.n)
elif isinstance(space, gym.spaces.HighLow):
n_dims = space.num_rows
handler = HighLowHandler(space.matrix)
elif isinstance(space, gym.spaces.Tuple):
raise NotImplementedError("Space of type '%s' is not supported"
% type(space))
return n_dims, handler
评论列表
文章目录