torch_geometric.transforms.AddRemainingSelfLoops

class AddRemainingSelfLoops(attr: str = 'edge_weight', fill_value: Union[float, Tensor, str] = 1.0)[source]

Bases: BaseTransform

向给定的同质或异质图添加剩余的自环(功能名称:add_remaining_self_loops)。

Parameters:
  • attr (str, optional) – 传递给torch_geometric.utils.add_remaining_self_loops()的边权重或多维边特征的属性名称。 (默认: "edge_weight")

  • fill_value (float or Tensor or str, optional) – The way to generate edge features of self-loops (in case attr != None). If given as float or torch.Tensor, edge features of self-loops will be directly given by fill_value. If given as str, edge features of self-loops are computed by aggregating all features of edges that point to the specific node, according to a reduce operation. ("add", "mean", "min", "max", "mul"). (default: 1.)