COSMIT: more robust condition in inverse_transform.

We need to support other formats than CSC and COO. Besides, tocsr()
doesn't trigger a copy if the matrix is already CSR.