dgl.ops.gspmmο
- dgl.ops.gspmm(g, op, reduce_op, lhs_data, rhs_data)[source]ο
Generalized Sparse Matrix Multiplication interface. It fuses two steps into one kernel.
Computes messages by
opsource node and edge features.Aggregate the messages by
reduce_opas the features on destination nodes.
\[x_v = \psi_{(u, v, e)\in \mathcal{G}}(\rho(x_u, x_e))\]where \(x_v\) is the returned feature on destination nodes, and \(x_u\), \(x_e\) refers to
u,erespectively. \(\rho\) means binary operatoropand \(\psi\) means reduce operatorreduce_op, \(\mathcal{G}\) is the graph we apply gspmm on:g.Note that this function does not handle gradients.
- Parameters:
g (DGLGraph) β The input graph.
op (str) β The binary opβs name, could be
add,sub,mul,div,copy_lhs,copy_rhs.reduce_op (str) β Reduce operator, could be
sum,max,min,mean.lhs_data (tensor or None) β The left operand, could be None if itβs not required by the op.
rhs_data (tensor or None) β The right operand, could be None if itβs not required by the op.
- Returns:
The result tensor.
- Return type:
tensor