xref: /aosp_15_r20/external/executorch/kernels/portable/custom_ops.yaml (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1# Copyright (c) Meta Platforms, Inc. and affiliates.
2#
3# This yaml file contains all operators that are not defined by the ATen
4# library.
5#
6# See the README.md file in this directory for a description of the syntax used
7# by this file.
8
9# This custom version of allclose is necessary because the native allclose's
10# (in native_functions.yaml) signature conflicts with the current function
11# signature requirements of Executorch. Specifically, the native returns a scalar
12# (bool), but Executorch requires that operators return either void or a tensor.
13# To get around this, the below op expects an out tensor which is expected to be
14# a single-element bool. The result of the allclose operation is written to that
15# tensor. Otherwise, this operator's semantics are the same as the native version.
16# TODO(T126667800) Remove dummy_param once custom namespaces are supported in the
17# portable op library.
18- func: allclose.out(Tensor self, Tensor other, float rtol=1e-05, float atol=1e-08, bool equal_nan=False, bool dummy_param=False, *, Tensor(a!) out) -> Tensor(a!)
19  kernels:
20    - arg_meta: null
21      kernel_name: torch::executor::allclose_out
22
23# The argument dummy_param is used solely to disambiguate this op from the native
24# allclose(). Otherwise, code calling this op is identical to the native op:
25# out = torch.ops.aten.allclose(a, b). The out variant pass attempts to convert
26# this call to the nonexistent native allclose.out and fails.
27# TODO(T126667800) Remove dummy_param once custom namespaces are supported in the
28# portable op library.
29- func: allclose.Tensor(Tensor self, Tensor other, float rtol=1e-05, float atol=1e-08, bool equal_nan=False, bool dummy_param=False) -> Tensor
30  kernels:
31    - arg_meta: null
32      kernel_name: torch::executor::allclose_tensor
33
34- func: linear.scratch_example(Tensor input, Tensor weight, Tensor? bias=None, *, Tensor(a!) out, Tensor(b!) _scratch_tensor) -> Tensor(a!)
35  kernels:
36    - arg_meta: null
37      kernel_name: torch::executor::linear_scratch_example
38