(self, *shape)
| 291 | return self |
| 292 | |
| 293 | def view(self, *shape): |
| 294 | assert self.is_contiguous() |
| 295 | if shape[-1] != self.size()[-1]: |
| 296 | raise ValueError( |
| 297 | "Can't change view on compressed dimension. " |
| 298 | f"{self.size()[-1]} v. {shape[-1]}.") |
| 299 | if np.prod(shape) != np.prod(self.size()): |
| 300 | raise ValueError( |
| 301 | "Mismatch in numel of Matrix and new shape. " |
| 302 | f"{np.prod(self.size())} v. {np.prod(shape)}") |
| 303 | return Matrix(shape, |
| 304 | self.data, |
| 305 | self.row_indices, |
| 306 | self.column_indices, |
| 307 | self.offsets, |
| 308 | self.column_indices_t, |
| 309 | self.offsets_t, |
| 310 | self.block_offsets_t) |
| 311 | |
| 312 | @property |
| 313 | def grad(self): |
no test coverage detected