torch_geometric.explain.algorithm.DummyExplainer
- class DummyExplainer[source]
-
一个返回随机解释的虚拟解释器(用于测试目的)。
- forward(model: Module, x: Union[Tensor, Dict[str, Tensor]], edge_index: Union[Tensor, Dict[Tuple[str, str, str], Tensor]], edge_attr: Optional[Union[Tensor, Dict[Tuple[str, str, str], Tensor]]] = None, **kwargs) Union[Explanation, HeteroExplanation][source]
计算解释。
- Parameters:
model (torch.nn.Module) – 要解释的模型。
x (Union[torch.Tensor, Dict[NodeType, torch.Tensor]]) – 输入的同构或异构图的节点特征。
edge_index (Union[torch.Tensor, Dict[NodeType, torch.Tensor]]) – 输入的同构或异构图的边索引。
目标 (torch.Tensor) – 模型的目标。
index (Union[int, Tensor], optional) – 要解释的模型输出的索引。可以是单个索引或索引的张量。(默认值:
None)**kwargs (可选) – 传递给
model的额外关键字参数。
- Return type: