MCPcopy Create free account
hub / github.com/easy-graph/Easy-Graph / v2v

Method v2v

easygraph/classes/hypergraph.py:1707–1744  ·  view source on GitHub ↗

r"""Message passing of ``vertices to vertices``. The combination of ``v2e`` and ``e2v``. Args: ``X`` (``torch.Tensor``): Vertex feature matrix. Size :math:`(|\mathcal{V}|, C)`. ``aggr`` (``str``): The aggregation method. Can be ``'mean'``, ``'sum'`` and ``'softmax_th

(
        self,
        X: torch.Tensor,
        aggr: str = "mean",
        drop_rate: float = 0.0,
        v2e_aggr: Optional[str] = None,
        v2e_weight: Optional[torch.Tensor] = None,
        v2e_drop_rate: Optional[float] = None,
        e_weight: Optional[torch.Tensor] = None,
        e2v_aggr: Optional[str] = None,
        e2v_weight: Optional[torch.Tensor] = None,
        e2v_drop_rate: Optional[float] = None,
    )

Source from the content-addressed store, hash-verified

1705 return X
1706
1707 def v2v(
1708 self,
1709 X: torch.Tensor,
1710 aggr: str = "mean",
1711 drop_rate: float = 0.0,
1712 v2e_aggr: Optional[str] = None,
1713 v2e_weight: Optional[torch.Tensor] = None,
1714 v2e_drop_rate: Optional[float] = None,
1715 e_weight: Optional[torch.Tensor] = None,
1716 e2v_aggr: Optional[str] = None,
1717 e2v_weight: Optional[torch.Tensor] = None,
1718 e2v_drop_rate: Optional[float] = None,
1719 ):
1720 r"""Message passing of ``vertices to vertices``. The combination of ``v2e`` and ``e2v``.
1721
1722 Args:
1723 ``X`` (``torch.Tensor``): Vertex feature matrix. Size :math:`(|\mathcal{V}|, C)`.
1724 ``aggr`` (``str``): The aggregation method. Can be ``'mean'``, ``'sum'`` and ``'softmax_then_sum'``. If specified, this ``aggr`` will be used to both ``v2e`` and ``e2v``.
1725 ``drop_rate`` (``float``): Dropout rate. Randomly dropout the connections in incidence matrix with probability ``drop_rate``. Default: ``0.0``.
1726 ``v2e_aggr`` (``str``, optional): The aggregation method for hyperedges to vertices. Can be ``'mean'``, ``'sum'`` and ``'softmax_then_sum'``. If specified, it will override the ``aggr`` in ``e2v``.
1727 ``v2e_weight`` (``torch.Tensor``, optional): The weight vector attached to connections (vertices point to hyepredges). If not specified, the function will use the weights specified in hypergraph construction. Defaults to ``None``.
1728 ``v2e_drop_rate`` (``float``, optional): Dropout rate for hyperedges to vertices. Randomly dropout the connections in incidence matrix with probability ``drop_rate``. If specified, it will override the ``drop_rate`` in ``e2v``. Default: ``None``.
1729 ``e_weight`` (``torch.Tensor``, optional): The hyperedge weight vector. If not specified, the function will use the weights specified in hypergraph construction. Defaults to ``None``.
1730 ``e2v_aggr`` (``str``, optional): The aggregation method for vertices to hyperedges. Can be ``'mean'``, ``'sum'`` and ``'softmax_then_sum'``. If specified, it will override the ``aggr`` in ``v2e``.
1731 ``e2v_weight`` (``torch.Tensor``, optional): The weight vector attached to connections (hyperedges point to vertices). If not specified, the function will use the weights specified in hypergraph construction. Defaults to ``None``.
1732 ``e2v_drop_rate`` (``float``, optional): Dropout rate for vertices to hyperedges. Randomly dropout the connections in incidence matrix with probability ``drop_rate``. If specified, it will override the ``drop_rate`` in ``v2e``. Default: ``None``.
1733 """
1734 if v2e_aggr is None:
1735 v2e_aggr = aggr
1736 if e2v_aggr is None:
1737 e2v_aggr = aggr
1738 if v2e_drop_rate is None:
1739 v2e_drop_rate = drop_rate
1740 if e2v_drop_rate is None:
1741 e2v_drop_rate = drop_rate
1742 X = self.v2e(X, v2e_aggr, v2e_weight, e_weight, drop_rate=v2e_drop_rate)
1743 X = self.e2v(X, e2v_aggr, e2v_weight, drop_rate=e2v_drop_rate)
1744 return X
1745
1746 def v2v_of_group(
1747 self,

Callers

nothing calls this directly

Calls 2

v2eMethod · 0.95
e2vMethod · 0.95

Tested by

no test coverage detected