dgl.ops.gsddmm

dgl.ops.gsddmm(g, op, lhs_data, rhs_data, lhs_target='u', rhs_target='v')[source]

Generalized Sampled-Dense-Dense Matrix Multiplication interface. It computes edge features by op lhs features and rhs features.

\[x_{e} = \phi(x_{lhs}, x_{rhs}), \forall (u,e,v)\in \mathcal{G}\]

where \(x_{e}\) is the returned feature on edges and \(x_u\), \(x_v\) refers to u, v respectively. \(\phi\) is the binary operator op, and \(\mathcal{G}\) is the graph we apply gsddmm on: g. \(lhs\) and \(rhs\) are one of \(u,v,e\)’s.

Parameters:
  • g (DGLGraph) – The input graph.

  • op (str) – Binary operator, could be add, sub, mul, div, dot, copy_lhs, copy_rhs.

  • lhs_data (tensor or None) – The left operand, could be None if it’s not required by op.

  • rhs_data (tensor or None) – The right operand, could be None if it’s not required by op.

  • lhs_target (str) – Choice of ``u``(source), ``e``(edge) or ``v``(destination) for left operand.

  • rhs_target (str) – Choice of ``u``(source), ``e``(edge) or ``v``(destination) for right operand.

Returns:

The result tensor.

Return type:

tensor