chainer.functions.sparse_matmul(a, b, transa=False, transb=False)[source]

Computes the batched multiplication of sparse and dense matrix.

The following use cases are supported:

  1. C (dense) = A (sparse) * B (dense)
  2. C (dense) = A (dense) * B (sparse)
  • a (Variable or CooMatrix) – The left operand of matrix multiplication.
  • b (Variable or CooMatrix) – The right operand of matrix multiplication.
  • transa (bool) – If True, each matrix in a will be transposed.
  • transb (bool) – If True, each matrix in b will be transposed.

Result of batched mat-mul.

Return type:


See also

See to_coo() for how to construct a COO matrix from an array.


Performance of this function on GPU can be improved by using the order argument of CooMatrix when the sparse matrix is created.