Home
last modified time | relevance | path

Searched refs:__torch_function__ (Results 1 – 25 of 46) sorted by relevance

12

/aosp_15_r20/external/pytorch/test/
H A Dtest_overrides.py145 def __torch_function__(cls, func, types, args=(), kwargs=None): member in DiagonalTensor
215 def __torch_function__(cls, func, types, args=(), kwargs=None): member in SubTensor
366 def __torch_function__(cls, func, types, args=(), kwargs=None): member in TensorLike
600 def __torch_function__(cls, func, types, args=(), kwargs=None): member in TestTorchFunctionOverride.test_grad.Dummy
612 def __torch_function__(cls, func, types, args=(), kwargs=None): member in TestTorchFunctionOverride.test_pow_rpow.NothingImplemented
617 def __torch_function__(cls, func, types, args=(), kwargs=None): member in TestTorchFunctionOverride.test_pow_rpow.RPowOnly
797 … return lambda *a, **kw: wrap(self.__torch_function__(c, (Wrapper,), args=a, kwargs=kw))
799 … return lambda *a, **kw: wrap(self.__torch_function__(c, (Wrapper,), args=(self,) + a, kwargs=kw))
817 def __torch_function__(cls, func, types, args=(), kwargs=None): member in Wrapper
836 return self.__torch_function__(torch.add, (Wrapper,), (self, other))
[all …]
/aosp_15_r20/external/pytorch/functorch/dim/
H A Dwrap_type.py29 def _py_wrap_method(orig, __torch_function__): argument
31 return __torch_function__(orig, None, args, kwargs)
36 def wrap_type(use_c, to_patch, pattern, __torch_function__): argument
47 return property(wrap_method(orig.__get__, __torch_function__))
70 setattr(to_patch, name, wrap_method(obj, __torch_function__))
H A D__init__.py48 __torch_function__ = classmethod(_C.__torch_function__) variable in _Tensor
51 __torch_function__ = reference.__torch_function__ variable in _Tensor
112 wrap_type(use_c, _Tensor, torch.Tensor, _Tensor.__torch_function__)
H A Dreference.py167 def __torch_function__(self, orig, cls, args, kwargs=empty_dict): function
306 return self.__torch_function__(torch.Tensor.expand, None, (self, *sizes))
423 return _Tensor.__torch_function__(_orig_getitem, None, (self, input))
/aosp_15_r20/external/pytorch/docs/source/notes/
H A Dextending.rst474 If your custom Python type defines a method named ``__torch_function__``, PyTorch
475 will invoke your ``__torch_function__`` implementation when an instance of your
478 :mod:`torch` namespace which your ``__torch_function__`` implementation can call,
531 Adding a ``__torch_function__`` implementation to ``ScalarTensor`` makes it
533 this time adding a ``__torch_function__`` implementation::
548 def __torch_function__(cls, func, types, args=(), kwargs=None):
558 The ``__torch_function__`` method takes four arguments: ``func``, a reference
560 types of Tensor-likes that implement ``__torch_function__``, ``args``, the
568 ``__torch_function__`` API, it is just a useful design pattern for
601 a tensor or tensor-like that defines ``__torch_function__``, for example for
[all …]
/aosp_15_r20/external/pytorch/benchmarks/overrides_benchmark/
H A DREADME.md1 # `__torch_function__` micro-benchmarks
3 This benchmark suite provides a systemic way to measure the performance of `__torch_function__` ove…
32__torch_function__` should add zero overhead for `torch.Tensor` inputs, a small overhead for subcl…
36 When modifying any of the machinery around `__torch_function__`, run the benchmark for both the fea…
H A Dcommon.py21 def __torch_function__(cls, func, types, args=(), kwargs=None): member in WithTorchFunction
30 def __torch_function__(cls, func, types, args=(), kwargs=None): member in SubWithTorchFunction
34 return super().__torch_function__(func, types, args, kwargs)
/aosp_15_r20/external/pytorch/test/dynamo/
H A Dtest_subclasses.py151 def __torch_function__(cls, func, types, args=(), kwargs=None): member in BaseTorchFunction
154 return super().__torch_function__(func, types, args, kwargs)
159 def __torch_function__(cls, func, types, args=(), kwargs=None): member in MockSubclass
170 def __torch_function__(cls, func, types, args=(), kwargs=None): member in AttrSubclass
179 def __torch_function__(cls, func, types, args=(), kwargs=None): member in DummyNDim
186 return super().__torch_function__(func, types, args, kwargs)
194 def __torch_function__(cls, func, types, args=(), kwargs=None): member in WrapperSubclass
206 def __torch_function__(cls, func, types, args=(), kwargs=None): member in SigmoidToExpSubclass
211 return super().__torch_function__(torch.Tensor.exp, types, args, kwargs)
213 return super().__torch_function__(func, types, args, kwargs)
[all …]
/aosp_15_r20/external/pytorch/torch/nn/
H A Dparameter.py92 __torch_function__ = _disabled_torch_function_impl variable in Parameter
161 def __torch_function__(cls, func, types, args=(), kwargs=None): member in UninitializedTensorMixin
167 return super().__torch_function__(func, types, args, kwargs)
251 __torch_function__ = _disabled_torch_function_impl variable in Buffer
/aosp_15_r20/external/pytorch/docs/source/
H A Dtorch.overrides.rst7 This module exposes various helper functions for the ``__torch_function__``
9 ``__torch_function__`` protocol.
/aosp_15_r20/external/pytorch/torch/fx/
H A DREADME.md89__torch_function__`](https://pytorch.org/docs/stable/notes/extending.html#extending-torch). If any…
102 …dule is run with Proxies as inputs, and recording happens via the `__torch_function__` dispatch pa…
/aosp_15_r20/external/pytorch/test/quantization/core/experimental/
H A Dtest_bits.py44 def __torch_function__(cls, func, types, args=(), kwargs=None): member in Int16Tensor
45 return super().__torch_function__(func, types, args, kwargs)
/aosp_15_r20/external/pytorch/torch/testing/_internal/
H A Dcommon_subclass.py168 def __torch_function__(cls, func, types, args=(), kwargs=None): member in NonWrapperTensor
169 result = super().__torch_function__(func, types, args, kwargs)
/aosp_15_r20/external/pytorch/torch/_dynamo/variables/
H A Dtorch_function.py228 )(value.__torch_function__.__func__)
230 return SourcelessBuilder.create(tx, value.__torch_function__.__func__)
H A Dtensor.py679 )(py_cls.__torch_function__.__func__)
1320 )(self.value.__torch_function__)
/aosp_15_r20/external/pytorch/tools/autograd/templates/
H A Dannotated_fn_args.py.in3 testing __torch_function__. See tests/test_overrides.py.
/aosp_15_r20/external/pytorch/test/nn/
H A Dtest_load_state_dict.py507 def __torch_function__(cls, func, types, args=(), kwargs=None): member in MyLoadTensor
515 def __torch_function__(cls, func, types, args=(), kwargs=None): member in MyLoadTensor2
521 def __torch_function__(cls, func, types, args=(), kwargs=None): member in MyBrokenLoadTensor
/aosp_15_r20/external/pytorch/torch/export/
H A D_safeguard.py18 def __torch_function__(self, func, types, args=(), kwargs=None): member in AutogradStateOpsFailSafeguard
/aosp_15_r20/external/pytorch/test/profiler/
H A Dtest_profiler_tree.py56 def __torch_function__(cls, func, types, args=(), kwargs=None): member in TorchFunctionTensor
57 return super().__torch_function__(func, types, args, kwargs)
/aosp_15_r20/external/pytorch/torch/utils/
H A D_device.py102 def __torch_function__(self, func, types, args=(), kwargs=None): member in DeviceContext
/aosp_15_r20/external/pytorch/torch/nn/utils/_expanded_weights/
H A Dexpanded_weights_impl.py125 def __torch_function__(cls, func, _, args=(), kwargs=None): member in ExpandedWeight
/aosp_15_r20/external/pytorch/torch/_prims/
H A Dcontext.py105 def __torch_function__( member in TorchRefsMode
/aosp_15_r20/external/pytorch/torch/nn/attention/
H A Dbias.py282 def __torch_function__(cls, func, types, args=(), kwargs=None): member in CausalBias
/aosp_15_r20/external/pytorch/torch/
H A Doverrides.py322 Tensor.__torch_function__,
1645 and arg_type.__torch_function__ != torch._C._disabled_torch_function_impl
1717 result = mode.__torch_function__(public_api, types, args, kwargs)
1725 torch_func_method = overloaded_arg.__torch_function__
2032 def __torch_function__(self, func, types, args=(), kwargs=None): member in TorchFunctionMode
2080 def __torch_function__(self, func, types, args=(), kwargs=None): member in BaseTorchFunctionMode
/aosp_15_r20/external/pytorch/torch/masked/maskedtensor/
H A Dcore.py285 def __torch_function__(cls, func, types, args=(), kwargs=None): member in MaskedTensor

12