code: def _coo_matmul_gradsp_cpu(A, B, C_row, C_col, dtype):
      # A.shape: ((nb,) _m, _k)
      # B.shape: ((nb,) _k, _n)
      # C_row/col.shape: ((nb,) ldnz)
      _m, _k = A.shape[-2:]
      ldnz = C_row.shape[-1]
      if hasattr(numpy, "matmul"):
          C = numpy.matmul(A, B)
      elif A.ndim == 2:
          C = numpy.dot(A, B)
      else:
          C = numpy.einsum("...ij,...jk->...ik", A, B)
      C = C.astype(dtype, copy=False)
      if A.ndim == 2:
          C_data = numpy.zeros((ldnz), dtype=dtype)
          nnz = len(numpy.where(C_row >= 0)[0])
          C_data[:nnz] = C[C_row[:nnz], C_col[:nnz]]
      else:
          nb = A.shape[0]
          C_data = numpy.zeros((nb, ldnz), dtype=dtype)
          for i in range(nb):
              nnz = len(numpy.where(C_row[i] >= 0)[0])
              C_data[i, :nnz] = C[i, C_row[i, :nnz], C_col[i, :nnz]]
  
      return C_data
  
imports: import numpy
  import chainer
  from chainer import backend
  from chainer.backends import cuda
  from chainer import function_node
  from chainer import utils
  from chainer.utils import type_check
label_desc: Use image node_id 6 for calling a global function with example usage: _coo_matmul_gradsp_cpu(A, B, C_row, C_col, dtype) and returns: C_data