SciPy

scipy.sparse.dia_matrix.reshape

dia_matrix.reshape(shape)[source]