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

Method v2e_update_of_group

easygraph/classes/hypergraph.py:1436–1460  ·  view source on GitHub ↗

r"""Message update step of ``vertices to hyperedges`` in specified hyperedge group. Args: ``group_name`` (``str``): The specified hyperedge group. ``X`` (``torch.Tensor``): Hyperedge feature matrix. Size :math:`(|\mathcal{E}|, C)`. ``e_weight`` (``torch.T

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

Source from the content-addressed store, hash-verified

1434 return X
1435
1436 def v2e_update_of_group(
1437 self, group_name: str, X: torch.Tensor, e_weight: Optional[torch.Tensor] = None
1438 ):
1439 r"""Message update step of ``vertices to hyperedges`` in specified hyperedge group.
1440
1441 Args:
1442 ``group_name`` (``str``): The specified hyperedge group.
1443 ``X`` (``torch.Tensor``): Hyperedge feature matrix. Size :math:`(|\mathcal{E}|, C)`.
1444 ``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``.
1445 """
1446 assert (
1447 group_name in self.group_names
1448 ), f"The specified {group_name} is not in existing hyperedge groups."
1449 if self.device != X.device:
1450 self.to(X.device)
1451 if e_weight is None:
1452 X = torch.sparse.mm(self.W_e_of_group(group_name), X)
1453 else:
1454 e_weight = e_weight.view(-1, 1)
1455 assert e_weight.shape[0] == self.num_e_of_group(group_name), (
1456 "The size of e_weight must be equal to the size of"
1457 f" self.num_e_of_group('{group_name}')."
1458 )
1459 X = e_weight * X
1460 return X
1461
1462 def v2e(
1463 self,

Callers 1

v2e_of_groupMethod · 0.95

Calls 3

toMethod · 0.95
W_e_of_groupMethod · 0.95
num_e_of_groupMethod · 0.95

Tested by

no test coverage detected