MCPcopy
hub / github.com/dmlc/dgl / _csrmm

Function _csrmm

python/dgl/_sparse_ops.py:802–832  ·  view source on GitHub ↗

Return a graph whose adjacency matrix is the sparse matrix multiplication of those of two given graphs. Note that the edge weights of both graphs must be scalar, i.e. :attr:`A_weights` and :attr:`B_weights` must be 1D vectors. Parameters ---------- A : HeteroGraphIndex

(A, A_weights, B, B_weights, num_vtypes)

Source from the content-addressed store, hash-verified

800
801
802def _csrmm(A, A_weights, B, B_weights, num_vtypes):
803 """Return a graph whose adjacency matrix is the sparse matrix multiplication
804 of those of two given graphs.
805
806 Note that the edge weights of both graphs must be scalar, i.e. :attr:`A_weights`
807 and :attr:`B_weights` must be 1D vectors.
808
809 Parameters
810 ----------
811 A : HeteroGraphIndex
812 The input graph index as left operand.
813 A_weights : Tensor
814 The edge weights of graph A as 1D tensor.
815 B : HeteroGraphIndex
816 The input graph index as right operand.
817 B_weights : Tensor
818 The edge weights of graph B as 1D tensor.
819 num_vtypes : int
820 The number of node types for the returned graph (must be either 1 or 2).
821
822 Returns
823 -------
824 C : HeteroGraphIndex
825 The output graph index.
826 C_weights : Tensor
827 The edge weights of the output graph.
828 """
829 C, C_weights = _CAPI_DGLCSRMM(
830 A, F.to_dgl_nd(A_weights), B, F.to_dgl_nd(B_weights), num_vtypes
831 )
832 return C, F.from_dgl_nd(C_weights)
833
834
835def _csrsum(As, A_weights):

Callers 5

forwardMethod · 0.85
backwardMethod · 0.85
csrmm_realFunction · 0.85
gradFunction · 0.85
forwardMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected