def __init__(self, env_spec, n_agents, hidden_sizes=(32, 32), hidden_nonlinearity=torch.tanh, hidden_w_init=nn.init.xavier_uniform_, hidden_b_init=nn.init.zeros_, output_nonlinearity=None, output_w_init=nn.init.xavier_uniform_, output_b_init=nn.init.zeros_, layer_normalization=False, name='CentralizedCategoricalMLPPolicy'): assert isinstance(env_spec.action_space, akro.Discrete), ( 'Categorical policy only works with akro.Discrete action space.') self.centralized = True self.vectorized = True self._n_agents = n_agents self._obs_dim = env_spec.observation_space.flat_dim self._action_dim = env_spec.action_space.n self.name = name MLPModule.__init__(self, input_dim=self._obs_dim, output_dim=self._action_dim * self._n_agents, hidden_sizes=hidden_sizes, hidden_nonlinearity=hidden_nonlinearity, hidden_w_init=hidden_w_init, hidden_b_init=hidden_b_init, output_nonlinearity=output_nonlinearity, output_w_init=output_w_init, output_b_init=output_b_init, layer_normalization=layer_normalization)
def __init__(self, env_spec, name="CategoricalMLPPolicy", **kwargs): self._obs_dim = env_spec.input_space.flat_dim self._action_dim = env_spec.output_space.flat_dim Policy.__init__(self, env_spec, name) MLPModule.__init__(self, input_dim=self._obs_dim, output_dim=self._action_dim, **kwargs)
def __init__(self, env_spec, **kwargs): """ Initialize class with multiple attributes. Args: env_spec (garage.envs.env_spec.EnvSpec): Environment specification. nn_module (nn.Module): Neural network module in PyTorch. """ self._env_spec = env_spec self._obs_dim = env_spec.observation_space.flat_dim self._action_dim = env_spec.action_space.flat_dim MLPModule.__init__(self, input_dim=self._obs_dim + self._action_dim, output_dim=1, **kwargs)
def __init__(self, env_spec, **kwargs): """Initialize class with multiple attributes. Args: env_spec (EnvSpec): Environment specification. **kwargs: Keyword arguments. """ self._env_spec = env_spec self._obs_dim = env_spec.observation_space.flat_dim self._action_dim = env_spec.action_space.flat_dim MLPModule.__init__(self, input_dim=self._obs_dim + self._action_dim, output_dim=1, **kwargs)
def __init__(self, env_spec, name='DeterministicMLPPolicy', **kwargs): """Initialize class with multiple attributes. Args: env_spec (garage.envs.env_spec.EnvSpec): Environment specification. name (str): Policy name. kwargs : Additional keyword arguments passed to the MLPModule. """ self._obs_dim = env_spec.observation_space.flat_dim self._action_dim = env_spec.action_space.flat_dim Policy.__init__(self, env_spec, name) MLPModule.__init__(self, input_dim=self._obs_dim, output_dim=self._action_dim, **kwargs)