Upload edit\Qwen3-TTS-test\.venv\Lib\site-packages\torch\include\ATen\native\quantized\cpu\QuantizedOps.h with huggingface_hub
Browse files
edit//Qwen3-TTS-test//.venv//Lib//site-packages//torch//include//ATen//native//quantized//cpu//QuantizedOps.h
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
#include <ATen/core/Tensor.h>
|
| 3 |
+
#include <ATen/core/IListRef.h>
|
| 4 |
+
#include <ATen/Dispatch.h>
|
| 5 |
+
#include <ATen/TensorIterator.h>
|
| 6 |
+
#include <ATen/native/Activation.h>
|
| 7 |
+
#include <ATen/native/DispatchStub.h>
|
| 8 |
+
|
| 9 |
+
namespace at::native {
|
| 10 |
+
|
| 11 |
+
using qrelu_fn = void (*)(const at::Tensor& /*qx*/, at::Tensor& /*qy*/);
|
| 12 |
+
using qrelu_leaky_fn = void (*)(Tensor& /*out*/, const Tensor& /*qx*/,
|
| 13 |
+
const Scalar& /*negval_*/);
|
| 14 |
+
using qgelu_fn = void (*)(const at::Tensor& /*qx*/, at::Tensor& /*qy*/, GeluType /* approximate */);
|
| 15 |
+
using qsigmoid_fn = void (*)(const at::Tensor& /*qx*/, at::Tensor& /*qy*/, double output_scale, int64_t output_zero_point);
|
| 16 |
+
using qhardsigmoid_fn = void (*)(const at::Tensor& /*qx*/, at::Tensor& /*qy*/);
|
| 17 |
+
using qclamp_fn = void (*)(
|
| 18 |
+
const at::Tensor& /*qx*/,
|
| 19 |
+
const Scalar& min,
|
| 20 |
+
const Scalar& max,
|
| 21 |
+
at::Tensor& /*qy*/);
|
| 22 |
+
using qclamp_minmax_fn = void (*)(
|
| 23 |
+
const at::Tensor& /*qx*/,
|
| 24 |
+
const Scalar& /*min or max*/,
|
| 25 |
+
at::Tensor& /*qy*/);
|
| 26 |
+
using qthreshold_fn = void (*)(
|
| 27 |
+
const at::Tensor& /*qx*/,
|
| 28 |
+
const Scalar& threshold,
|
| 29 |
+
const Scalar& value,
|
| 30 |
+
at::Tensor& /*qy*/);
|
| 31 |
+
using qtanh_fn = void (*)(const at::Tensor& /*qx*/, at::Tensor& /*qy*/);
|
| 32 |
+
using qelu_fn = void(*)(
|
| 33 |
+
const at::Tensor& /*qx*/,
|
| 34 |
+
const Scalar& /*alpha*/,
|
| 35 |
+
const Scalar& /*scale*/,
|
| 36 |
+
const Scalar& /*input_scale*/,
|
| 37 |
+
at::Tensor& /*qy*/);
|
| 38 |
+
using qbinary_fn =
|
| 39 |
+
void (*)(Tensor& /*out*/, const Tensor& /*self*/, const Tensor& /*other*/);
|
| 40 |
+
using qadd_scalar_fn =
|
| 41 |
+
void (*)(Tensor& /*out*/, const Tensor& /*self*/, const Scalar& other /*other*/);
|
| 42 |
+
using qhardswish_fn = void (*)(const at::Tensor& /*qx*/, at::Tensor& /*qy*/);
|
| 43 |
+
using qdropout_fn = void(*)(
|
| 44 |
+
const at::Tensor& /*qx*/,
|
| 45 |
+
const Scalar& /*p*/,
|
| 46 |
+
bool training /*training*/,
|
| 47 |
+
at::Tensor& /*qy*/);
|
| 48 |
+
using qmaxpool_2d_fn = void (*)(
|
| 49 |
+
const Tensor& qx,
|
| 50 |
+
int64_t iC, // input/output channels
|
| 51 |
+
int64_t iH,
|
| 52 |
+
int64_t iW, // input sizes
|
| 53 |
+
int64_t oH,
|
| 54 |
+
int64_t oW, // output sizes
|
| 55 |
+
int64_t kH,
|
| 56 |
+
int64_t kW, // kernel size
|
| 57 |
+
int64_t sH,
|
| 58 |
+
int64_t sW, // strides
|
| 59 |
+
int64_t pH,
|
| 60 |
+
int64_t pW, // padding
|
| 61 |
+
int64_t dH,
|
| 62 |
+
int64_t dW, // dilation
|
| 63 |
+
Tensor& qy);
|
| 64 |
+
using qmaxpool_3d_fn = void (*)(
|
| 65 |
+
const Tensor& qx,
|
| 66 |
+
int64_t iC, // input/output channels
|
| 67 |
+
int64_t iT,
|
| 68 |
+
int64_t iH,
|
| 69 |
+
int64_t iW, // input sizes
|
| 70 |
+
int64_t oT,
|
| 71 |
+
int64_t oH,
|
| 72 |
+
int64_t oW, // output sizes
|
| 73 |
+
int64_t kT,
|
| 74 |
+
int64_t kH,
|
| 75 |
+
int64_t kW, // kernel size
|
| 76 |
+
int64_t sT,
|
| 77 |
+
int64_t sH,
|
| 78 |
+
int64_t sW, // strides
|
| 79 |
+
int64_t pT,
|
| 80 |
+
int64_t pH,
|
| 81 |
+
int64_t pW, // padding
|
| 82 |
+
int64_t dT,
|
| 83 |
+
int64_t dH,
|
| 84 |
+
int64_t dW, // dilation
|
| 85 |
+
Tensor& qy);
|
| 86 |
+
using qadaptive_avg_pool2d_fn = void (*)(
|
| 87 |
+
const Tensor& qx,
|
| 88 |
+
Tensor& qy,
|
| 89 |
+
int64_t sizeB,
|
| 90 |
+
int64_t sizeC,
|
| 91 |
+
int64_t isizeH,
|
| 92 |
+
int64_t isizeW,
|
| 93 |
+
int64_t osizeH,
|
| 94 |
+
int64_t osizeW,
|
| 95 |
+
int64_t istrideB,
|
| 96 |
+
int64_t istrideC,
|
| 97 |
+
int64_t istrideH,
|
| 98 |
+
int64_t istrideW);
|
| 99 |
+
using qadaptive_avg_pool3d_fn = void (*)(
|
| 100 |
+
const Tensor& qx,
|
| 101 |
+
Tensor& qy,
|
| 102 |
+
int64_t sizeB,
|
| 103 |
+
int64_t sizeC,
|
| 104 |
+
int64_t isizeD,
|
| 105 |
+
int64_t isizeH,
|
| 106 |
+
int64_t isizeW,
|
| 107 |
+
int64_t osizeD,
|
| 108 |
+
int64_t osizeH,
|
| 109 |
+
int64_t osizeW,
|
| 110 |
+
int64_t istrideB,
|
| 111 |
+
int64_t istrideC,
|
| 112 |
+
int64_t istrideD,
|
| 113 |
+
int64_t istrideH,
|
| 114 |
+
int64_t istrideW);
|
| 115 |
+
using qavg_pool2d_fn = void (*)(
|
| 116 |
+
const Tensor& qx,
|
| 117 |
+
Tensor& qy,
|
| 118 |
+
int64_t nBatch,
|
| 119 |
+
int64_t nInputPlane,
|
| 120 |
+
int64_t inputWidth,
|
| 121 |
+
int64_t inputHeight,
|
| 122 |
+
int64_t outputWidth,
|
| 123 |
+
int64_t outputHeight,
|
| 124 |
+
int kW,
|
| 125 |
+
int kH,
|
| 126 |
+
int dW,
|
| 127 |
+
int dH,
|
| 128 |
+
int padW,
|
| 129 |
+
int padH,
|
| 130 |
+
bool count_include_pad,
|
| 131 |
+
std::optional<int64_t> divisor_override);
|
| 132 |
+
|
| 133 |
+
using qavg_pool3d_fn = void (*)(
|
| 134 |
+
const Tensor& qx,
|
| 135 |
+
Tensor& qy,
|
| 136 |
+
int64_t nBatch,
|
| 137 |
+
int64_t nInputPlane,
|
| 138 |
+
int64_t inputWidth,
|
| 139 |
+
int64_t inputHeight,
|
| 140 |
+
int64_t inputDepth,
|
| 141 |
+
int64_t outputWidth,
|
| 142 |
+
int64_t outputHeight,
|
| 143 |
+
int64_t outputDepth,
|
| 144 |
+
int kW,
|
| 145 |
+
int kH,
|
| 146 |
+
int kD,
|
| 147 |
+
int dW,
|
| 148 |
+
int dH,
|
| 149 |
+
int dD,
|
| 150 |
+
int padW,
|
| 151 |
+
int padH,
|
| 152 |
+
int padD,
|
| 153 |
+
bool count_include_pad,
|
| 154 |
+
std::optional<int64_t> divisor_override);
|
| 155 |
+
|
| 156 |
+
using qupsample_bilinear2d_fn = void (*)(
|
| 157 |
+
Tensor& output,
|
| 158 |
+
const Tensor& input,
|
| 159 |
+
int64_t input_height,
|
| 160 |
+
int64_t input_width,
|
| 161 |
+
int64_t output_height,
|
| 162 |
+
int64_t output_width,
|
| 163 |
+
int64_t nbatch,
|
| 164 |
+
int64_t channels,
|
| 165 |
+
bool align_corners,
|
| 166 |
+
std::optional<double> scales_h,
|
| 167 |
+
std::optional<double> scales_w);
|
| 168 |
+
|
| 169 |
+
using qcat_nhwc_fn = Tensor (*)(
|
| 170 |
+
const MaterializedITensorListRef& qxs,
|
| 171 |
+
int64_t dim,
|
| 172 |
+
double scale,
|
| 173 |
+
int64_t zero_point);
|
| 174 |
+
using qtopk_fn = void(*)(Tensor&, Tensor&, const Tensor&, int64_t, int64_t, bool, bool);
|
| 175 |
+
|
| 176 |
+
using qbatch_norm_fn = void(*)(int64_t, int64_t, int64_t, int64_t, int64_t, const Tensor&, const Tensor&, const Tensor&, Tensor&);
|
| 177 |
+
|
| 178 |
+
using qnormalize_fn = void (*)(
|
| 179 |
+
const Tensor& /* X */,
|
| 180 |
+
const Tensor& /* gamma */,
|
| 181 |
+
const Tensor& /* beta */,
|
| 182 |
+
bool /* affine_per_channel */,
|
| 183 |
+
int /* num_channels */,
|
| 184 |
+
int /* num_groups */,
|
| 185 |
+
int64_t /* M */,
|
| 186 |
+
int64_t /* N */,
|
| 187 |
+
double /* eps */,
|
| 188 |
+
Tensor* /* Y */);
|
| 189 |
+
|
| 190 |
+
using qmean_inner_dim_fn = void (*)(
|
| 191 |
+
const Tensor& /* X */,
|
| 192 |
+
OptionalIntArrayRef /* opt_dim */,
|
| 193 |
+
bool /* keepdim */,
|
| 194 |
+
std::optional<ScalarType> /* opt_dtype */,
|
| 195 |
+
Tensor& /* Y */);
|
| 196 |
+
|
| 197 |
+
using qstd_inner_dim_fn = void (*)(
|
| 198 |
+
const Tensor& /* X */,
|
| 199 |
+
OptionalIntArrayRef /* dim */,
|
| 200 |
+
const std::optional<Scalar>& /* correction */,
|
| 201 |
+
bool /* keepdim */,
|
| 202 |
+
Tensor& /* Y */);
|
| 203 |
+
|
| 204 |
+
using qnormalize_nhwc_fn = void (*)(
|
| 205 |
+
const Tensor& /* X */,
|
| 206 |
+
const Tensor& /* gamma */,
|
| 207 |
+
const Tensor& /* beta */,
|
| 208 |
+
bool /* affine_per_channel */,
|
| 209 |
+
int /* num_channels */,
|
| 210 |
+
int /* num_groups */,
|
| 211 |
+
int64_t /* M */,
|
| 212 |
+
int64_t /* N */,
|
| 213 |
+
double /* eps */,
|
| 214 |
+
Tensor* /* Y */);
|
| 215 |
+
|
| 216 |
+
using qprelu_fn = void (*)(Tensor& /*out*/, const Tensor& /*qx*/,
|
| 217 |
+
const Tensor& /*qw*/);
|
| 218 |
+
|
| 219 |
+
DECLARE_DISPATCH(qadaptive_avg_pool2d_fn, qadaptive_avg_pool2d_nhwc_stub)
|
| 220 |
+
DECLARE_DISPATCH(qadaptive_avg_pool3d_fn, qadaptive_avg_pool3d_ndhwc_stub)
|
| 221 |
+
DECLARE_DISPATCH(qadd_scalar_fn, qadd_scalar_relu_stub)
|
| 222 |
+
DECLARE_DISPATCH(qadd_scalar_fn, qadd_scalar_stub)
|
| 223 |
+
DECLARE_DISPATCH(qavg_pool2d_fn, qavg_pool2d_nhwc_stub)
|
| 224 |
+
DECLARE_DISPATCH(qavg_pool3d_fn, qavg_pool3d_nhwc_stub)
|
| 225 |
+
DECLARE_DISPATCH(qbatch_norm_fn, qbatch_norm_relu_stub)
|
| 226 |
+
DECLARE_DISPATCH(qbatch_norm_fn, qbatch_norm_stub)
|
| 227 |
+
DECLARE_DISPATCH(qbinary_fn, qadd_relu_stub)
|
| 228 |
+
DECLARE_DISPATCH(qbinary_fn, qadd_stub)
|
| 229 |
+
DECLARE_DISPATCH(qbinary_fn, qmul_relu_stub)
|
| 230 |
+
DECLARE_DISPATCH(qbinary_fn, qmul_stub)
|
| 231 |
+
DECLARE_DISPATCH(qcat_nhwc_fn, qcat_nhwc_stub)
|
| 232 |
+
DECLARE_DISPATCH(qcat_nhwc_fn, qcat_relu_nhwc_stub)
|
| 233 |
+
DECLARE_DISPATCH(qclamp_fn, qclamp_stub)
|
| 234 |
+
DECLARE_DISPATCH(qclamp_minmax_fn, qclamp_min_stub)
|
| 235 |
+
DECLARE_DISPATCH(qclamp_minmax_fn, qclamp_max_stub)
|
| 236 |
+
DECLARE_DISPATCH(qelu_fn, qelu_stub)
|
| 237 |
+
DECLARE_DISPATCH(qhardsigmoid_fn, qhardsigmoid_stub)
|
| 238 |
+
DECLARE_DISPATCH(qhardswish_fn, qhardswish_stub)
|
| 239 |
+
DECLARE_DISPATCH(qdropout_fn, qdropout_stub)
|
| 240 |
+
DECLARE_DISPATCH(qmaxpool_2d_fn, qmaxpool_2d_nhwc_stub)
|
| 241 |
+
DECLARE_DISPATCH(qmaxpool_3d_fn, qmaxpool_3d_nthwc_stub)
|
| 242 |
+
DECLARE_DISPATCH(qnormalize_fn, quantized_normalize_stub)
|
| 243 |
+
DECLARE_DISPATCH(qnormalize_nhwc_fn, quantized_groupnorm_nhwc_stub)
|
| 244 |
+
DECLARE_DISPATCH(qrelu_fn, qrelu_stub)
|
| 245 |
+
DECLARE_DISPATCH(qrelu_leaky_fn, qrelu_leaky_stub)
|
| 246 |
+
DECLARE_DISPATCH(qgelu_fn, qgelu_stub)
|
| 247 |
+
DECLARE_DISPATCH(qsigmoid_fn, qsigmoid_stub)
|
| 248 |
+
DECLARE_DISPATCH(qtanh_fn, qtanh_stub)
|
| 249 |
+
DECLARE_DISPATCH(qthreshold_fn, qthreshold_stub)
|
| 250 |
+
DECLARE_DISPATCH(qtopk_fn, qtopk_stub)
|
| 251 |
+
DECLARE_DISPATCH(qupsample_bilinear2d_fn, qupsample_bilinear2d_nhwc_stub)
|
| 252 |
+
DECLARE_DISPATCH(qmean_inner_dim_fn, qmean_inner_dim_stub)
|
| 253 |
+
DECLARE_DISPATCH(qstd_inner_dim_fn, qstd_inner_dim_stub)
|
| 254 |
+
DECLARE_DISPATCH(qprelu_fn, qprelu_stub)
|
| 255 |
+
|
| 256 |
+
} // namespace at::native
|