# chainer.utils.CooMatrix¶

class chainer.utils.CooMatrix(data, row, col, shape, requires_grad=False)[source]

A sparse matrix in COO format.

Parameters: data (numpy.ndarray or cupy.ndarray) – The entries of the matrix. The entries are usually non-zero-elements in the matrix. row (numpy.ndarray or cupy.ndarray) – The row indices of the matrix entries. col (numpy.ndarray or cupy.ndarray) – The column indices of the matrix entries. shape (tuple of int) – The shape of the matrix in dense format. requires_grad (bool) – If True, gradient of this sparse matrix will be computed in back-propagation.

See to_coo() for how to construct a COO matrix from an array.
to_dense()[source]