communications¶ attention_comm¶ class xuance.torch.communications.attention_comm.TarMAC(*args: Any, **kwargs: Any)[source]¶ Bases: IC3NetComm attention_block(q, k, v)[source]¶ forward(obs: torch.Tensor, msg_send: dict, alive_ally: dict, gate_control: dict = None, agent_key: str | None = None) → torch.Tensor[source]¶ base_comm¶ class xuance.torch.communications.base_comm.BaseComm(*args: Any, **kwargs: Any)[source]¶ Bases: Module forward(hidden_features: torch.Tensor)[source]¶ class xuance.torch.communications.base_comm.NoneComm(*args: Any, **kwargs: Any)[source]¶ Bases: Module forward(msg: torch.Tensor, **kwargs)[source]¶ comm_net¶ class xuance.torch.communications.comm_net.CommNet(*args: Any, **kwargs: Any)[source]¶ Bases: Module create_mlp(input_shape: int, layers: list, out_shape: int, activation: torch.nn.Module, device: str | torch.device) → torch.nn.Sequential[source]¶ forward(obs: torch.Tensor, msg_send: dict, alive_ally: dict) → torch.Tensor[source]¶ message_encode(message: torch.Tensor) → torch.Tensor[source]¶ obs_encode(observation)[source]¶ emergent_comm¶ gnn_comm¶ class xuance.torch.communications.gnn_comm.DGNComm(*args: Any, **kwargs: Any)[source]¶ Bases: CommNet build_gcn(num_layers, num_heads, activation=torch.nn.ReLU)[source]¶ create_adjacency_matrix(alive_ally)[source]¶ forward(obs: torch.Tensor, msg_send: dict, alive_ally: dict) → torch.Tensor[source]¶ gcn_block(x, adj_matrix)[source]¶ class xuance.torch.communications.gnn_comm.GraphMultiHeadAttentionLayer(*args: Any, **kwargs: Any)[source]¶ Bases: Module forward(x, adj)[source]¶ x: node feature matrix [batch_size, n_agents, input_dim] adj: adjacency matrix [batch_size, n_agents, n_agents] reset_parameters()[source]¶ ic3net_comm¶ class xuance.torch.communications.ic3net_comm.IC3NetComm(*args: Any, **kwargs: Any)[source]¶ Bases: CommNet forward(obs: torch.Tensor, msg_send: dict, alive_ally: dict, gate_control: dict = None)[source]¶