from gym import spaces


def get_action_type(action_space):
    r"""
    Method to get the action type to choose prob. dist. to sample actions from NN logits output
    :param action_space:
    :return:
    """
    if isinstance(action_space, spaces.Box):
        shape = action_space.shape
        assert len(shape) == 1
        if shape[0] == 1:
            return 'continuous'
        else:
            return 'multi_continuous'
    elif isinstance(action_space, spaces.Discrete):
        return 'discrete'
    elif isinstance(action_space, spaces.MultiDiscrete):
        return 'multi_discrete'
    elif isinstance(action_space, spaces.MultiBinary):
        return 'multi_binary'
    else:
        raise NotImplementedError

from gym import spaces


def get_action_type(action_space):
    r"""
    Method to get the action type to choose prob. dist. to sample actions from NN logits output
    :param action_space:
    :return:
    """
    if isinstance(action_space, spaces.Box):
        shape = action_space.shape
        assert len(shape) == 1
        if shape[0] == 1:
            return 'continuous'
        else:
            return 'multi_continuous'
    elif isinstance(action_space, spaces.Discrete):
        return 'discrete'
    elif isinstance(action_space, spaces.MultiDiscrete):
        return 'multi_discrete'
    elif isinstance(action_space, spaces.MultiBinary):
        return 'multi_binary'
    else:
        raise NotImplementedError

Method to get the action type to choose prob. dist. to sample actions from NN logits output     :param action_space:     :return: