Binds `pyfunc` into ``dask.array.apply_gufunc`` when called. Parameters ---------- pyfunc : callable Function to call like ``func(*args, **kwargs)`` on input arrays (``*args``) that returns an array or tuple of arrays. If multiple arguments with non-matching
| 578 | |
| 579 | |
| 580 | class gufunc: |
| 581 | """ |
| 582 | Binds `pyfunc` into ``dask.array.apply_gufunc`` when called. |
| 583 | |
| 584 | Parameters |
| 585 | ---------- |
| 586 | pyfunc : callable |
| 587 | Function to call like ``func(*args, **kwargs)`` on input arrays |
| 588 | (``*args``) that returns an array or tuple of arrays. If multiple |
| 589 | arguments with non-matching dimensions are supplied, this function is |
| 590 | expected to vectorize (broadcast) over axes of positional arguments in |
| 591 | the style of NumPy universal functions [1]_ (if this is not the case, |
| 592 | set ``vectorize=True``). If this function returns multiple outputs, |
| 593 | ``output_core_dims`` has to be set as well. |
| 594 | signature : String, keyword only |
| 595 | Specifies what core dimensions are consumed and produced by ``func``. |
| 596 | According to the specification of numpy.gufunc signature [2]_ |
| 597 | axes: List of tuples, optional, keyword only |
| 598 | A list of tuples with indices of axes a generalized ufunc should operate on. |
| 599 | For instance, for a signature of ``"(i,j),(j,k)->(i,k)"`` appropriate for |
| 600 | matrix multiplication, the base elements are two-dimensional matrices |
| 601 | and these are taken to be stored in the two last axes of each argument. The |
| 602 | corresponding axes keyword would be ``[(-2, -1), (-2, -1), (-2, -1)]``. |
| 603 | For simplicity, for generalized ufuncs that operate on 1-dimensional arrays |
| 604 | (vectors), a single integer is accepted instead of a single-element tuple, |
| 605 | and for generalized ufuncs for which all outputs are scalars, the output |
| 606 | tuples can be omitted. |
| 607 | axis: int, optional, keyword only |
| 608 | A single axis over which a generalized ufunc should operate. This is a short-cut |
| 609 | for ufuncs that operate over a single, shared core dimension, equivalent to passing |
| 610 | in axes with entries of (axis,) for each single-core-dimension argument and ``()`` for |
| 611 | all others. For instance, for a signature ``"(i),(i)->()"``, it is equivalent to passing |
| 612 | in ``axes=[(axis,), (axis,), ()]``. |
| 613 | keepdims: bool, optional, keyword only |
| 614 | If this is set to True, axes which are reduced over will be left in the result as |
| 615 | a dimension with size one, so that the result will broadcast correctly against the |
| 616 | inputs. This option can only be used for generalized ufuncs that operate on inputs |
| 617 | that all have the same number of core dimensions and with outputs that have no core |
| 618 | dimensions , i.e., with signatures like ``"(i),(i)->()"`` or ``"(m,m)->()"``. |
| 619 | If used, the location of the dimensions in the output can be controlled with axes |
| 620 | and axis. |
| 621 | output_dtypes : Optional, dtype or list of dtypes, keyword only |
| 622 | Valid numpy dtype specification or list thereof. |
| 623 | If not given, a call of ``func`` with a small set of data |
| 624 | is performed in order to try to automatically determine the |
| 625 | output dtypes. |
| 626 | output_sizes : dict, optional, keyword only |
| 627 | Optional mapping from dimension names to sizes for outputs. Only used if |
| 628 | new core dimensions (not found on inputs) appear on outputs. |
| 629 | vectorize: bool, keyword only |
| 630 | If set to ``True``, ``np.vectorize`` is applied to ``func`` for |
| 631 | convenience. Defaults to ``False``. |
| 632 | allow_rechunk: Optional, bool, keyword only |
| 633 | Allows rechunking, otherwise chunk sizes need to match and core |
| 634 | dimensions are to consist only of one chunk. |
| 635 | Warning: enabling this can increase memory usage significantly. |
| 636 | Defaults to ``False``. |
| 637 | meta: Optional, tuple, keyword only |
no outgoing calls