torch_geometric.nn.functional.bro

bro(x: Tensor, batch: Tensor, p: Union[int, str] = 2) Tensor[source]

来自“通过正交化和诱导稀疏性提高分子图神经网络可解释性”论文的批量表示正交性惩罚。

根据以下内容计算小批量中每个图表示的正则化

\[\mathcal{L}_{\textrm{BRO}}^\mathrm{graph} = || \mathbf{HH}^T - \mathbf{I}||_p\]

并返回批次中所有图的平均值。

Parameters:
  • x (torch.Tensor) – The node feature matrix.

  • batch (torch.Tensor) – The batch vector \(\mathbf{b} \in {\{ 0, \ldots, B-1\}}^N\), which assigns each node to a specific example.

  • p (intstr, 可选) – 使用的范数顺序。(默认值:2

Return type:

Tensor