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

Method W_e_of_group

easygraph/classes/hypergraph.py:803–821  ·  view source on GitHub ↗

r"""Return the weight matrix :math:`\mathbf{W}_e` of hyperedges of the specified hyperedge group with ``torch.Tensor`` format. Args: ``group_name`` (``str``): The name of the specified hyperedge group.

(self, group_name: str)

Source from the content-addressed store, hash-verified

801 return self.cache["W_e"]
802
803 def W_e_of_group(self, group_name: str) -> torch.Tensor:
804 r"""Return the weight matrix :math:`\mathbf{W}_e` of hyperedges of the specified hyperedge group with ``torch.Tensor`` format.
805
806 Args:
807 ``group_name`` (``str``): The name of the specified hyperedge group.
808 """
809 assert (
810 group_name in self.group_names
811 ), f"The specified {group_name} is not in existing hyperedge groups."
812 if self.group_cache[group_name].get("W_e") is None:
813 _tmp = self._fetch_W_of_group(group_name).view(-1)
814 _num_e = _tmp.size(0)
815 self.group_cache[group_name]["W_e"] = torch.sparse_coo_tensor(
816 torch.arange(0, _num_e).view(1, -1).repeat(2, 1),
817 _tmp,
818 torch.Size([_num_e, _num_e]),
819 device=self.device,
820 ).coalesce()
821 return self.group_cache[group_name]["W_e"]
822
823 @property
824 def D_v(self) -> torch.Tensor:

Callers 4

W_eMethod · 0.95
L_rw_of_groupMethod · 0.95
L_HGNN_of_groupMethod · 0.95
v2e_update_of_groupMethod · 0.95

Calls 2

_fetch_W_of_groupMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected