| #include <ATen/ATen.h> |
| #include <ATen/native/Activation.h> |
| #include <ATen/native/DispatchStub.h> |
| #include <ATen/native/TensorIterator.h> |
|
|
| namespace at { |
| namespace native { |
|
|
| using qrelu_fn = void (*)(const at::Tensor& , at::Tensor& ); |
| using qrelu_leaky_fn = void (*)(Tensor& , const Tensor& , |
| const Scalar& ); |
| using qgelu_fn = void (*)(const at::Tensor& , at::Tensor& , GeluType ); |
| using qsigmoid_fn = void (*)(const at::Tensor& , at::Tensor& , double output_scale, int64_t output_zero_point); |
| using qhardsigmoid_fn = void (*)(const at::Tensor& , at::Tensor& ); |
| using qclamp_fn = void (*)( |
| const at::Tensor& , |
| const Scalar& min, |
| const Scalar& max, |
| at::Tensor& ); |
| using qclamp_minmax_fn = void (*)( |
| const at::Tensor& , |
| const Scalar& , |
| at::Tensor& ); |
| using qthreshold_fn = void (*)( |
| const at::Tensor& , |
| const Scalar& threshold, |
| const Scalar& value, |
| at::Tensor& ); |
| using qtanh_fn = void (*)(const at::Tensor& , at::Tensor& ); |
| using qelu_fn = void(*)( |
| const at::Tensor& , |
| const Scalar& , |
| const Scalar& , |
| const Scalar& , |
| at::Tensor& ); |
| using qbinary_fn = |
| void (*)(Tensor& , const Tensor& , const Tensor& ); |
| using qadd_scalar_fn = |
| void (*)(Tensor& , const Tensor& , const Scalar& other ); |
| using qhardswish_fn = void (*)(const at::Tensor& , at::Tensor& ); |
| using qdropout_fn = void(*)( |
| const at::Tensor& , |
| const Scalar& , |
| bool training , |
| at::Tensor& ); |
| using qmaxpool_2d_fn = void (*)( |
| const Tensor& qx, |
| int64_t iC, |
| int64_t iH, |
| int64_t iW, |
| int64_t oH, |
| int64_t oW, |
| int64_t kH, |
| int64_t kW, |
| int64_t sH, |
| int64_t sW, |
| int64_t pH, |
| int64_t pW, |
| int64_t dH, |
| int64_t dW, |
| Tensor& qy); |
| using qadaptive_avg_pool2d_fn = void (*)( |
| const Tensor& qx, |
| Tensor& qy, |
| int64_t sizeB, |
| int64_t sizeC, |
| int64_t isizeH, |
| int64_t isizeW, |
| int64_t osizeH, |
| int64_t osizeW, |
| int64_t istrideB, |
| int64_t istrideC, |
| int64_t istrideH, |
| int64_t istrideW); |
| using qadaptive_avg_pool3d_fn = void (*)( |
| const Tensor& qx, |
| Tensor& qy, |
| int64_t sizeB, |
| int64_t sizeC, |
| int64_t isizeD, |
| int64_t isizeH, |
| int64_t isizeW, |
| int64_t osizeD, |
| int64_t osizeH, |
| int64_t osizeW, |
| int64_t istrideB, |
| int64_t istrideC, |
| int64_t istrideD, |
| int64_t istrideH, |
| int64_t istrideW); |
| using qavg_pool2d_fn = void (*)( |
| const Tensor& qx, |
| Tensor& qy, |
| int64_t nBatch, |
| int64_t nInputPlane, |
| int64_t inputWidth, |
| int64_t inputHeight, |
| int64_t outputWidth, |
| int64_t outputHeight, |
| int kW, |
| int kH, |
| int dW, |
| int dH, |
| int padW, |
| int padH, |
| bool count_include_pad, |
| c10::optional<int64_t> divisor_override); |
|
|
| using qavg_pool3d_fn = void (*)( |
| const Tensor& qx, |
| Tensor& qy, |
| int64_t nBatch, |
| int64_t nInputPlane, |
| int64_t inputWidth, |
| int64_t inputHeight, |
| int64_t inputDepth, |
| int64_t outputWidth, |
| int64_t outputHeight, |
| int64_t outputDepth, |
| int kW, |
| int kH, |
| int kD, |
| int dW, |
| int dH, |
| int dD, |
| int padW, |
| int padH, |
| int padD, |
| bool count_include_pad, |
| c10::optional<int64_t> divisor_override); |
|
|
| using qupsample_bilinear2d_fn = void (*)( |
| Tensor& output, |
| const Tensor& input, |
| int64_t input_height, |
| int64_t input_width, |
| int64_t output_height, |
| int64_t output_width, |
| int64_t nbatch, |
| int64_t channels, |
| bool align_corners, |
| c10::optional<double> scales_h, |
| c10::optional<double> scales_w); |
|
|
| using qcat_nhwc_fn = Tensor (*)( |
| const MaterializedITensorListRef& qxs, |
| int64_t dim, |
| double scale, |
| int64_t zero_point); |
| using qtopk_fn = void(*)(Tensor&, Tensor&, const Tensor&, int64_t, int64_t, bool, bool); |
|
|
| using qbatch_norm_fn = void(*)(int64_t, int64_t, int64_t, int64_t, int64_t, const Tensor&, const Tensor&, const Tensor&, Tensor&); |
|
|
| using qnormalize_fn = void (*)( |
| const Tensor& , |
| const Tensor& , |
| const Tensor& , |
| bool , |
| int , |
| int , |
| int64_t , |
| int64_t , |
| double , |
| Tensor* ); |
|
|
| using qmean_inner_dim_fn = void (*)( |
| const Tensor& , |
| OptionalIntArrayRef , |
| bool , |
| c10::optional<ScalarType> , |
| Tensor& ); |
|
|
| using qstd_inner_dim_fn = void (*)( |
| const Tensor& , |
| OptionalIntArrayRef , |
| optional<int64_t> , |
| bool , |
| Tensor& ); |
|
|
| using qnormalize_nhwc_fn = void (*)( |
| const Tensor& , |
| const Tensor& , |
| const Tensor& , |
| bool , |
| int , |
| int , |
| int64_t , |
| int64_t , |
| double , |
| Tensor* ); |
|
|
| using qprelu_fn = void (*)(Tensor& , const Tensor& , |
| const Tensor& ); |
|
|
| DECLARE_DISPATCH(qadaptive_avg_pool2d_fn, qadaptive_avg_pool2d_nhwc_stub); |
| DECLARE_DISPATCH(qadaptive_avg_pool3d_fn, qadaptive_avg_pool3d_ndhwc_stub); |
| DECLARE_DISPATCH(qadd_scalar_fn, qadd_scalar_relu_stub); |
| DECLARE_DISPATCH(qadd_scalar_fn, qadd_scalar_stub); |
| DECLARE_DISPATCH(qavg_pool2d_fn, qavg_pool2d_nhwc_stub); |
| DECLARE_DISPATCH(qavg_pool3d_fn, qavg_pool3d_nhwc_stub); |
| DECLARE_DISPATCH(qbatch_norm_fn, qbatch_norm_relu_stub); |
| DECLARE_DISPATCH(qbatch_norm_fn, qbatch_norm_stub); |
| DECLARE_DISPATCH(qbinary_fn, qadd_relu_stub); |
| DECLARE_DISPATCH(qbinary_fn, qadd_stub); |
| DECLARE_DISPATCH(qbinary_fn, qmul_relu_stub); |
| DECLARE_DISPATCH(qbinary_fn, qmul_stub); |
| DECLARE_DISPATCH(qcat_nhwc_fn, qcat_nhwc_stub); |
| DECLARE_DISPATCH(qcat_nhwc_fn, qcat_relu_nhwc_stub); |
| DECLARE_DISPATCH(qclamp_fn, qclamp_stub); |
| DECLARE_DISPATCH(qclamp_minmax_fn, qclamp_min_stub); |
| DECLARE_DISPATCH(qclamp_minmax_fn, qclamp_max_stub); |
| DECLARE_DISPATCH(qelu_fn, qelu_stub); |
| DECLARE_DISPATCH(qhardsigmoid_fn, qhardsigmoid_stub); |
| DECLARE_DISPATCH(qhardswish_fn, qhardswish_stub); |
| DECLARE_DISPATCH(qdropout_fn, qdropout_stub); |
| DECLARE_DISPATCH(qmaxpool_2d_fn, qmaxpool_2d_nhwc_stub); |
| DECLARE_DISPATCH(qnormalize_fn, quantized_normalize_stub); |
| DECLARE_DISPATCH(qnormalize_nhwc_fn, quantized_groupnorm_nhwc_stub); |
| DECLARE_DISPATCH(qrelu_fn, qrelu_stub); |
| DECLARE_DISPATCH(qrelu_leaky_fn, qrelu_leaky_stub); |
| DECLARE_DISPATCH(qgelu_fn, qgelu_stub); |
| DECLARE_DISPATCH(qsigmoid_fn, qsigmoid_stub); |
| DECLARE_DISPATCH(qtanh_fn, qtanh_stub); |
| DECLARE_DISPATCH(qthreshold_fn, qthreshold_stub); |
| DECLARE_DISPATCH(qtopk_fn, qtopk_stub); |
| DECLARE_DISPATCH(qupsample_bilinear2d_fn, qupsample_bilinear2d_nhwc_stub); |
| DECLARE_DISPATCH(qmean_inner_dim_fn, qmean_inner_dim_stub); |
| DECLARE_DISPATCH(qstd_inner_dim_fn, qstd_inner_dim_stub); |
| DECLARE_DISPATCH(qprelu_fn, qprelu_stub); |
|
|
| } |
| } |
|
|