Decorator for ``dask.array.gufunc``. Parameters ---------- signature : String Specifies what core dimensions are consumed and produced by ``func``. According to the specification of numpy.gufunc signature [2]_ axes: List of tuples, optional, keyword only
(signature=None, **kwargs)
| 741 | |
| 742 | |
| 743 | def as_gufunc(signature=None, **kwargs): |
| 744 | """ |
| 745 | Decorator for ``dask.array.gufunc``. |
| 746 | |
| 747 | Parameters |
| 748 | ---------- |
| 749 | signature : String |
| 750 | Specifies what core dimensions are consumed and produced by ``func``. |
| 751 | According to the specification of numpy.gufunc signature [2]_ |
| 752 | axes: List of tuples, optional, keyword only |
| 753 | A list of tuples with indices of axes a generalized ufunc should operate on. |
| 754 | For instance, for a signature of ``"(i,j),(j,k)->(i,k)"`` appropriate for |
| 755 | matrix multiplication, the base elements are two-dimensional matrices |
| 756 | and these are taken to be stored in the two last axes of each argument. The |
| 757 | corresponding axes keyword would be ``[(-2, -1), (-2, -1), (-2, -1)]``. |
| 758 | For simplicity, for generalized ufuncs that operate on 1-dimensional arrays |
| 759 | (vectors), a single integer is accepted instead of a single-element tuple, |
| 760 | and for generalized ufuncs for which all outputs are scalars, the output |
| 761 | tuples can be omitted. |
| 762 | axis: int, optional, keyword only |
| 763 | A single axis over which a generalized ufunc should operate. This is a short-cut |
| 764 | for ufuncs that operate over a single, shared core dimension, equivalent to passing |
| 765 | in axes with entries of (axis,) for each single-core-dimension argument and ``()`` for |
| 766 | all others. For instance, for a signature ``"(i),(i)->()"``, it is equivalent to passing |
| 767 | in ``axes=[(axis,), (axis,), ()]``. |
| 768 | keepdims: bool, optional, keyword only |
| 769 | If this is set to True, axes which are reduced over will be left in the result as |
| 770 | a dimension with size one, so that the result will broadcast correctly against the |
| 771 | inputs. This option can only be used for generalized ufuncs that operate on inputs |
| 772 | that all have the same number of core dimensions and with outputs that have no core |
| 773 | dimensions , i.e., with signatures like ``"(i),(i)->()"`` or ``"(m,m)->()"``. |
| 774 | If used, the location of the dimensions in the output can be controlled with axes |
| 775 | and axis. |
| 776 | output_dtypes : Optional, dtype or list of dtypes, keyword only |
| 777 | Valid numpy dtype specification or list thereof. |
| 778 | If not given, a call of ``func`` with a small set of data |
| 779 | is performed in order to try to automatically determine the |
| 780 | output dtypes. |
| 781 | output_sizes : dict, optional, keyword only |
| 782 | Optional mapping from dimension names to sizes for outputs. Only used if |
| 783 | new core dimensions (not found on inputs) appear on outputs. |
| 784 | vectorize: bool, keyword only |
| 785 | If set to ``True``, ``np.vectorize`` is applied to ``func`` for |
| 786 | convenience. Defaults to ``False``. |
| 787 | allow_rechunk: Optional, bool, keyword only |
| 788 | Allows rechunking, otherwise chunk sizes need to match and core |
| 789 | dimensions are to consist only of one chunk. |
| 790 | Warning: enabling this can increase memory usage significantly. |
| 791 | Defaults to ``False``. |
| 792 | meta: Optional, tuple, keyword only |
| 793 | tuple of empty ndarrays describing the shape and dtype of the output of the gufunc. |
| 794 | Defaults to ``None``. |
| 795 | |
| 796 | Returns |
| 797 | ------- |
| 798 | Decorator for `pyfunc` that itself returns a `gufunc`. |
| 799 | |
| 800 | Examples |
nothing calls this directly
no test coverage detected
searching dependent graphs…