xnn.gnn.fast.allegro_kernels.contract#

xnn.gnn.fast.allegro_kernels.contract(x, y, c, pattern)[source]#

The sparse contraction of the Allegro tensor product (see xnn.gnn.fast.allegro).

Parameters:
  • x (Tensor) – The two operands, one row per edge and channel, shapes (R, dim1) and (R, dim2).

  • y (Tensor) – The two operands, one row per edge and channel, shapes (R, dim1) and (R, dim2).

  • c (Tensor) – The coefficients of the nonzero entries, in the order of pattern.

  • pattern (tuple) – The nonzero entries (k, i, j) of the coupling and its shape (dim_out, dim1, dim2).

Returns:

out[r, k] = sum_t c_t x[r, i_t] y[r, j_t], shape (R, dim_out).

Return type:

Tensor