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

Method W_e

easygraph/classes/hypergraph.py:786–801  ·  view source on GitHub ↗

r"""Return the weight matrix :math:`\mathbf{W}_e` of hyperedges with ``torch.Tensor`` format.

(self)

Source from the content-addressed store, hash-verified

784
785 @property
786 def W_e(self) -> torch.Tensor:
787 r"""Return the weight matrix :math:`\mathbf{W}_e` of hyperedges with ``torch.Tensor`` format.
788 """
789 if self.cache.get("W_e") is None:
790 _tmp = [
791 self.W_e_of_group(name)._values().clone() for name in self.group_names
792 ]
793 _tmp = torch.cat(_tmp, dim=0).view(-1)
794 _num_e = _tmp.size(0)
795 self.cache["W_e"] = torch.sparse_coo_tensor(
796 torch.arange(0, _num_e).view(1, -1).repeat(2, 1),
797 _tmp,
798 torch.Size([_num_e, _num_e]),
799 device=self.device,
800 ).coalesce()
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.

Callers

nothing calls this directly

Calls 3

W_e_of_groupMethod · 0.95
cloneMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected