xref: /aosp_15_r20/external/pytorch/aten/src/ATen/native/PointwiseOps.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 // Ternary and higher-order pointwise operations
2 #pragma once
3 
4 #include <ATen/native/DispatchStub.h>
5 
6 namespace c10 {
7 class Scalar;
8 }
9 
10 namespace at {
11 
12 struct TensorIterator;
13 struct TensorIteratorBase;
14 
15 namespace native {
16 
17 using pointwise_fn = void (*)(TensorIterator&, const Scalar& scalar);
18 using structured_pointwise_fn = void (*)(TensorIteratorBase&, const Scalar& scalar);
19 using pointwise_fn_double = void (*)(TensorIterator&, const Scalar&, double);
20 
21 DECLARE_DISPATCH(structured_pointwise_fn, addcmul_stub);
22 DECLARE_DISPATCH(structured_pointwise_fn, addcdiv_stub);
23 DECLARE_DISPATCH(pointwise_fn_double, smooth_l1_backward_stub);
24 DECLARE_DISPATCH(pointwise_fn_double, huber_backward_stub);
25 DECLARE_DISPATCH(pointwise_fn, mse_backward_stub);
26 
27 } // namespace native
28 } // namespace at
29