torch_geometric.explain.algorithm.ExplainerAlgorithm
- class ExplainerAlgorithm[source]
 Bases:
Module用于实现解释器算法的抽象基类。
- abstract forward(model: Module, x: Union[Tensor, Dict[str, Tensor]], edge_index: Union[Tensor, Dict[Tuple[str, str, str], Tensor]], *, target: Tensor, index: Optional[Union[int, Tensor]] = None, **kwargs) Union[Explanation, HeteroExplanation][source]
 计算解释。
- Parameters:
 model (torch.nn.Module) – The model to explain.
x (Union[torch.Tensor, Dict[NodeType, torch.Tensor]]) – The input node features of a homogeneous or heterogeneous graph.
edge_index (Union[torch.Tensor, Dict[NodeType, torch.Tensor]]) – The input edge indices of a homogeneous or heterogeneous graph.
target (torch.Tensor) – The target of the model.
index (Union[int, Tensor], optional) – The index of the model output to explain. Can be a single index or a tensor of indices. (default:
None)**kwargs (optional) – Additional keyword arguments passed to
model.
- Return type:
 
- abstract supports() bool[source]
 Checks if the explainer supports the user-defined settings provided in
self.explainer_config,self.model_config.
- property explainer_config: ExplainerConfig
 返回已连接的解释器配置。
- Return type:
 
- property model_config: ModelConfig
 返回连接的模型配置。
- Return type:
 
- connect(explainer_config: ExplainerConfig, model_config: ModelConfig)[source]
 将解释器和模型配置连接到解释器算法。