Commit da953805 authored by Joseph Weston's avatar Joseph Weston

set model format correctly when reshaping sparse matrices

Sparse matrix reshaping is not guaranteed to keep the same sparse
format.
parent fa2f535b
Pipeline #24023 passed with stage
in 2 minutes and 43 seconds
......@@ -690,7 +690,7 @@ class Model(UserDict):
"""Reshape, see numpy.reshape."""
result = self.zeros_like()
result.data = {key: val.reshape(*args, **kwargs) for key, val in self.items()}
result.shape, _ = _shape_and_format(self[1].reshape(*args, **kwargs))
result.shape, result.format = _shape_and_format(self[1].reshape(*args, **kwargs))
return result
def allclose(self, other, rtol=1e-05, atol=1e-08, equal_nan=False):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment