openrl.modules.networks package¶
Subpackages¶
- openrl.modules.networks.utils package
- Subpackages
- Submodules
- openrl.modules.networks.utils.act module
- openrl.modules.networks.utils.attention module
- openrl.modules.networks.utils.cnn module
- openrl.modules.networks.utils.distributed_utils module
- openrl.modules.networks.utils.distributions module
- openrl.modules.networks.utils.mix module
- openrl.modules.networks.utils.mlp module
- openrl.modules.networks.utils.popart module
- openrl.modules.networks.utils.rnn module
- openrl.modules.networks.utils.running_mean_std module
- openrl.modules.networks.utils.transformer_act module
- openrl.modules.networks.utils.util module
- openrl.modules.networks.utils.vdn module
- Module contents
Submodules¶
openrl.modules.networks.MAT_network module¶
- class openrl.modules.networks.MAT_network.DecodeBlock(n_embd, n_head, n_agent)[source]¶
Bases:
torch.nn.modules.module.Modulean unassuming Transformer block
- forward(x, rep_enc)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class openrl.modules.networks.MAT_network.Decoder(obs_dim, action_dim, n_block, n_embd, n_head, n_agent, action_type='Discrete', dec_actor=False, share_actor=False)[source]¶
Bases:
torch.nn.modules.module.Module- forward(action, obs_rep, obs)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class openrl.modules.networks.MAT_network.EncodeBlock(n_embd, n_head, n_agent)[source]¶
Bases:
torch.nn.modules.module.Modulean unassuming Transformer block
- forward(x)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class openrl.modules.networks.MAT_network.Encoder(state_dim, obs_dim, n_block, n_embd, n_head, n_agent, encode_state)[source]¶
Bases:
torch.nn.modules.module.Module- forward(state, obs)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class openrl.modules.networks.MAT_network.MultiAgentTransformer(cfg, input_space, action_space, device=device(type='cpu'), use_half=False, extra_args=None)[source]¶
Bases:
openrl.modules.networks.base_value_policy_network.BaseValuePolicyNetwork
- class openrl.modules.networks.MAT_network.SelfAttention(n_embd, n_head, n_agent, masked=False)[source]¶
Bases:
torch.nn.modules.module.Module- forward(key, value, query)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
openrl.modules.networks.base_policy_network module¶
openrl.modules.networks.base_value_network module¶
- class openrl.modules.networks.base_value_network.BaseValueNetwork(cfg, device)[source]¶
Bases:
abc.ABC,torch.nn.modules.module.Module- abstract forward()[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
openrl.modules.networks.base_value_policy_network module¶
- class openrl.modules.networks.base_value_policy_network.BaseValuePolicyNetwork(cfg, device)[source]¶
Bases:
abc.ABC,torch.nn.modules.module.Module- forward(forward_type, *args, **kwargs)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
openrl.modules.networks.ddpg_network module¶
- class openrl.modules.networks.ddpg_network.ActorNetwork(cfg, input_space, action_space, device=device(type='cpu'), use_half=False, extra_args=None)[source]¶
Bases:
openrl.modules.networks.base_policy_network.BasePolicyNetwork- forward(obs)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class openrl.modules.networks.ddpg_network.CriticNetwork(cfg, input_space, action_space, device=device(type='cpu'), use_half=False, extra_args=None)[source]¶
Bases:
openrl.modules.networks.base_value_network.BaseValueNetwork- forward(state, action, rnn_states, masks)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class openrl.modules.networks.ddpg_network.CriticNetwork_v0(cfg, input_space, action_space, device=device(type='cpu'), use_half=False)[source]¶
Bases:
openrl.modules.networks.base_value_network.BaseValueNetwork- forward(state, action, rnn_states, masks)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
openrl.modules.networks.gail_discriminator module¶
openrl.modules.networks.policy_network module¶
- class openrl.modules.networks.policy_network.PolicyNetwork(cfg, input_space, action_space, device=device(type='cpu'), use_half=False, extra_args=None)[source]¶
Bases:
openrl.modules.networks.base_policy_network.BasePolicyNetwork- forward(forward_type, *args, **kwargs)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
openrl.modules.networks.policy_network_gpt module¶
openrl.modules.networks.policy_value_network module¶
- class openrl.modules.networks.policy_value_network.PolicyValueNetwork(cfg, input_space, action_space, device=device(type='cpu'), use_half=False, extra_args=None)[source]¶
Bases:
openrl.modules.networks.base_value_policy_network.BaseValuePolicyNetwork
openrl.modules.networks.policy_value_network_gpt module¶
openrl.modules.networks.policy_value_network_sb3 module¶
openrl.modules.networks.q_network module¶
- class openrl.modules.networks.q_network.QNetwork(cfg, input_space, action_space, device=device(type='cpu'), use_half=False, extra_args=None)[source]¶
Bases:
openrl.modules.networks.base_value_network.BaseValueNetwork- forward(obs, rnn_states, masks, action_masks=None)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
openrl.modules.networks.sac_network module¶
- class openrl.modules.networks.sac_network.SACActorNetwork(cfg, input_space, action_space, device=device(type='cpu'), use_half=False, extra_args=None, log_std_min=- 20, log_std_max=2)[source]¶
Bases:
openrl.modules.networks.ddpg_network.ActorNetwork- forward(obs)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
openrl.modules.networks.value_network module¶
- class openrl.modules.networks.value_network.ValueNetwork(cfg, input_space, action_space=None, use_half=False, device=device(type='cpu'), extra_args=None)[source]¶
Bases:
openrl.modules.networks.base_value_network.BaseValueNetwork- forward(critic_obs, rnn_states, masks)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
openrl.modules.networks.value_network_gpt module¶
openrl.modules.networks.vdn_network module¶
- class openrl.modules.networks.vdn_network.VDNNetwork(cfg, input_space, action_space, device=device(type='cpu'), use_half=False, extra_args=None)[source]¶
Bases:
openrl.modules.networks.base_value_policy_network.BaseValuePolicyNetwork- forward(forward_type, *args, **kwargs)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.