SciPy

scipy.sparse.dia_matrix.shape

dia_matrix.shape