| 533 | |
| 534 | |
| 535 | class GUfuncLeafExpr(ArrayExpr): |
| 536 | _parameters = [ |
| 537 | "array", |
| 538 | "i", |
| 539 | "name_prefix", |
| 540 | "loop_output_chunks", |
| 541 | "core_shapes", |
| 542 | "ocd", |
| 543 | "nout", |
| 544 | "input_meta", |
| 545 | "loop_output_shape", |
| 546 | ] |
| 547 | |
| 548 | @functools.cached_property |
| 549 | def _meta(self): |
| 550 | return meta_from_array(self.input_meta, len(self._shape)) |
| 551 | |
| 552 | @functools.cached_property |
| 553 | def _name(self): |
| 554 | last_name = self.array._name.split("-")[-1] |
| 555 | return f"{self.name_prefix}_{self.i}-{last_name}" |
| 556 | |
| 557 | @functools.cached_property |
| 558 | def _shape(self): |
| 559 | core_output_shape = tuple(self.core_shapes[d] for d in self.ocd) |
| 560 | return self.loop_output_shape + core_output_shape |
| 561 | |
| 562 | @functools.cached_property |
| 563 | def chunks(self): |
| 564 | output_chunks = self.loop_output_chunks + tuple( |
| 565 | self.core_shapes[d] for d in self.ocd |
| 566 | ) |
| 567 | return normalize_chunks(output_chunks, self._shape, dtype=self._meta.dtype) |
| 568 | |
| 569 | def _layer(self): |
| 570 | core_chunkinds = len(self.ocd) * (0,) |
| 571 | leaf_dsk = { |
| 572 | (self._name,) |
| 573 | + key[1:] |
| 574 | + core_chunkinds: ((getitem, key, self.i) if self.nout else key) |
| 575 | for key in list(flatten(self.array.__dask_keys__())) |
| 576 | } |
| 577 | return leaf_dsk |
| 578 | |
| 579 | |
| 580 | class gufunc: |
no outgoing calls
no test coverage detected
searching dependent graphs…