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

Method v2e_update

easygraph/classes/hypergraph.py:1417–1434  ·  view source on GitHub ↗

r"""Message update step of ``vertices to hyperedges``. Args: ``X`` (``torch.Tensor``): Hyperedge feature matrix. Size :math:`(|\mathcal{E}|, C)`. ``e_weight`` (``torch.Tensor``, optional): The hyperedge weight vector. If not specified, the function will use the weigh

(self, X: torch.Tensor, e_weight: Optional[torch.Tensor] = None)

Source from the content-addressed store, hash-verified

1415 return X
1416
1417 def v2e_update(self, X: torch.Tensor, e_weight: Optional[torch.Tensor] = None):
1418 r"""Message update step of ``vertices to hyperedges``.
1419
1420 Args:
1421 ``X`` (``torch.Tensor``): Hyperedge feature matrix. Size :math:`(|\mathcal{E}|, C)`.
1422 ``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``.
1423 """
1424 if self.device != X.device:
1425 self.to(X.device)
1426 if e_weight is None:
1427 X = torch.sparse.mm(self.W_e, X)
1428 else:
1429 e_weight = e_weight.view(-1, 1)
1430 assert (
1431 e_weight.shape[0] == self.num_e
1432 ), "The size of e_weight must be equal to the size of self.num_e."
1433 X = e_weight * X
1434 return X
1435
1436 def v2e_update_of_group(
1437 self, group_name: str, X: torch.Tensor, e_weight: Optional[torch.Tensor] = None

Callers 1

v2eMethod · 0.95

Calls 1

toMethod · 0.95

Tested by

no test coverage detected