(self)
| 335 | |
| 336 | @property |
| 337 | def _meta(self): |
| 338 | meta = self.array._meta |
| 339 | if self.reduced_meta is not None: |
| 340 | try: |
| 341 | meta = self.func(self.reduced_meta, computing_meta=True) |
| 342 | # no meta keyword argument exists for func, and it isn't required |
| 343 | except TypeError: |
| 344 | try: |
| 345 | meta = self.func(self.reduced_meta) |
| 346 | except ValueError as e: |
| 347 | # min/max functions have no identity, don't apply function to meta |
| 348 | if "zero-size array to reduction operation" in str(e): |
| 349 | meta = self.reduced_meta |
| 350 | # when no work can be computed on the empty array (e.g., func is a ufunc) |
| 351 | except ValueError: |
| 352 | pass |
| 353 | |
| 354 | # some functions can't compute empty arrays (those for which reduced_meta |
| 355 | # fall into the ValueError exception) and we have to rely on reshaping |
| 356 | # the array according to len(out_chunks) |
| 357 | if is_arraylike(meta) and meta.ndim != len(self.chunks): |
| 358 | if len(self.chunks) == 0: |
| 359 | meta = meta.sum() |
| 360 | else: |
| 361 | meta = meta.reshape((0,) * len(self.chunks)) |
| 362 | |
| 363 | return meta |
| 364 | |
| 365 | |
| 366 | from dask.array._array_expr._collection import blockwise |
nothing calls this directly
no test coverage detected