numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturns
array_function_dispatch(dispatcher, module=None, verify=True, docs_from_dispatcher=False)

See NEP-18 for example usage.

Parameters

dispatcher : callable

Function that when called like dispatcher(*args, **kwargs) with arguments from the NumPy function call returns an iterable of array-like arguments to check for __array_function__ .

module : str, optional

__module__ attribute to set on new function, e.g., module='numpy' . By default, module is copied from the decorated function.

verify : bool, optional

If True, verify the that the signature of the dispatcher and decorated function signatures match exactly: all required and optional arguments should appear in order with the same names, but the default values for all optional arguments should be None . Only disable verification if the dispatcher's signature needs to deviate for some particular reason, e.g., because the function has a signature like func(*args, **kwargs) .

docs_from_dispatcher : bool, optional

If True, copy docs from the dispatcher function onto the dispatched function, rather than from the implementation. This is useful for functions defined in C, which otherwise don't have docstrings.

Returns

Function suitable for decorating the implementation of a NumPy function.

Decorator for adding dispatch with the __array_function__ protocol.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/core/overrides.py#128
type: <class 'function'>
Commit: