/usr/local/lib64/python3.6/site-packages/torch/__pycache__
Edit: /usr/local/lib64/python3.6/site-packages/torch/__pycache__/overrides.cpython-36.pyc (124306B)
3
EgH @ s d Z ddlZddlZddlZddlZddlZddlmZmZm Z m
Z
mZmZm
Z
ddlZddlmZmZmZmZ ddddd d
ddgZejdee d
ddZejdee d
ddZejdeeef d
ddZedddZee
e e
dddZeee
e
dddZeedZeedZeedZejdee
e e f d
ddZejdee d
ddZ ee!dd dZ"d!d
Z#dS )"aE
Python implementation of ``__torch_function__``
While most of the torch API and handling for ``__torch_function__`` happens
at the C++ level, some of the torch API is written in Python so we need
python-level handling for ``__torch_function__`` overrides as well. The main
developer-facing functionality in this file are handle_torch_function and
has_torch_function. See torch/functional.py and test/test_overrides.py
for usage examples.
Note
----
heavily inspired by NumPy's ``__array_function__`` (see:
https://github.com/pytorch/pytorch/issues/24015 and
https://www.numpy.org/neps/nep-0018-array-function-protocol.html
)
If changing this file in a way that can affect ``__torch_function__`` overhead,
please report the benchmarks in ``benchmarks/overrides_benchmark``. See the
instructions in the ``README.md`` in that directory.
N)DictSetListAnyCallableIterableType)_has_torch_function_has_torch_function_unary_has_torch_function_variadic_add_docstrget_ignored_functionsget_overridable_functionsget_testing_overrideshandle_torch_functionhas_torch_functionis_tensor_likeis_tensor_method_or_propertywrap_torch_function)returnc C s t j} t jt jt jt jt jt jt jt j t j
t jt jt j
t jt jt jt jt jt jt jt jt jt jt jt jt jt jt jt jt jt jt j t j!t j"t j#t j$t j%t j&t