Upload edit\Qwen3-TTS-test\.venv\Lib\site-packages\torch\include\ATen\native\quantized\AffineQuantizer.h with huggingface_hub
Browse files
edit//Qwen3-TTS-test//.venv//Lib//site-packages//torch//include//ATen//native//quantized//AffineQuantizer.h
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <ATen/core/Tensor.h>
|
| 4 |
+
#include <ATen/Dispatch.h>
|
| 5 |
+
#include <ATen/native/DispatchStub.h>
|
| 6 |
+
#include <ATen/native/quantized/AffineQuantizerBase.h>
|
| 7 |
+
|
| 8 |
+
namespace at::native {
|
| 9 |
+
|
| 10 |
+
TORCH_API Tensor& quantize_tensor_per_tensor_affine(
|
| 11 |
+
const Tensor& rtensor,
|
| 12 |
+
Tensor& qtensor,
|
| 13 |
+
double scale,
|
| 14 |
+
int64_t zero_point);
|
| 15 |
+
TORCH_API Tensor& quantize_tensor_per_channel_affine(
|
| 16 |
+
const Tensor& rtensor,
|
| 17 |
+
Tensor& qtensor,
|
| 18 |
+
const Tensor& scales,
|
| 19 |
+
Tensor zero_points,
|
| 20 |
+
int64_t axis);
|
| 21 |
+
|
| 22 |
+
TORCH_API Tensor& quantize_tensor_per_channel_float_qparams(
|
| 23 |
+
const Tensor& rtensor,
|
| 24 |
+
Tensor& qtensor,
|
| 25 |
+
const Tensor& scales,
|
| 26 |
+
const Tensor& zero_points,
|
| 27 |
+
int64_t axis);
|
| 28 |
+
|
| 29 |
+
TORCH_API Tensor& dequantize_tensor_per_tensor_affine(
|
| 30 |
+
const Tensor& qtensor,
|
| 31 |
+
Tensor& rtensor,
|
| 32 |
+
double scale,
|
| 33 |
+
int64_t zero_point);
|
| 34 |
+
TORCH_API Tensor& dequantize_tensor_per_channel_affine(
|
| 35 |
+
const Tensor& qtensor,
|
| 36 |
+
Tensor& rtensor,
|
| 37 |
+
const Tensor& scales,
|
| 38 |
+
Tensor zero_points,
|
| 39 |
+
int64_t axis);
|
| 40 |
+
TORCH_API Tensor& dequantize_tensor_per_channel_float_qparams(
|
| 41 |
+
const Tensor& qtensor,
|
| 42 |
+
Tensor& rtensor,
|
| 43 |
+
const Tensor& scales,
|
| 44 |
+
const Tensor& zero_points,
|
| 45 |
+
int64_t axis);
|
| 46 |
+
|
| 47 |
+
using quantize_tensor_per_tensor_affine_fn =
|
| 48 |
+
void (*)(const Tensor& rtensor, Tensor& qtensor, double scale, int64_t zero_point);
|
| 49 |
+
|
| 50 |
+
using quantize_tensor_per_channel_affine_fn = void (*)(
|
| 51 |
+
const Tensor& rtensor,
|
| 52 |
+
Tensor& qtensor,
|
| 53 |
+
const Tensor& scales,
|
| 54 |
+
const Tensor& zero_points,
|
| 55 |
+
int64_t axis);
|
| 56 |
+
|
| 57 |
+
using quantize_tensor_per_channel_float_qparams_fn = void (*)(
|
| 58 |
+
const Tensor& rtensor,
|
| 59 |
+
Tensor& qtensor,
|
| 60 |
+
const Tensor& scales,
|
| 61 |
+
const Tensor& zero_points,
|
| 62 |
+
int64_t axis);
|
| 63 |
+
|
| 64 |
+
using dequantize_tensor_per_tensor_affine_fn =
|
| 65 |
+
void (*)(const Tensor& qtensor, Tensor& rtensor, double scale, int64_t zero_point);
|
| 66 |
+
|
| 67 |
+
using dequantize_tensor_per_channel_affine_fn = void (*)(
|
| 68 |
+
const Tensor& qtensor,
|
| 69 |
+
Tensor& rtensor,
|
| 70 |
+
const Tensor& scales,
|
| 71 |
+
const Tensor& zero_points,
|
| 72 |
+
int64_t axis);
|
| 73 |
+
|
| 74 |
+
using dequantize_tensor_per_channel_float_qparams_fn = void (*)(
|
| 75 |
+
const Tensor& qtensor,
|
| 76 |
+
Tensor& rtensor,
|
| 77 |
+
const Tensor& scales,
|
| 78 |
+
const Tensor& zero_points,
|
| 79 |
+
int64_t axis);
|
| 80 |
+
|
| 81 |
+
using quantize_tensor_per_tensor_affine_sub_byte_fn =
|
| 82 |
+
void (*)(const Tensor& rtensor, Tensor& qtensor, float scale, float zero_point);
|
| 83 |
+
|
| 84 |
+
using dequantize_tensor_per_tensor_affine_sub_byte_fn =
|
| 85 |
+
void (*)(const Tensor& qtensor, Tensor& rtensor, float scale, float zero_point);
|
| 86 |
+
|
| 87 |
+
DECLARE_DISPATCH(
|
| 88 |
+
quantize_tensor_per_tensor_affine_fn,
|
| 89 |
+
quantize_tensor_per_tensor_affine_stub)
|
| 90 |
+
DECLARE_DISPATCH(
|
| 91 |
+
quantize_tensor_per_channel_affine_fn,
|
| 92 |
+
quantize_tensor_per_channel_affine_stub)
|
| 93 |
+
DECLARE_DISPATCH(
|
| 94 |
+
quantize_tensor_per_channel_float_qparams_fn,
|
| 95 |
+
quantize_tensor_per_channel_float_qparams_stub)
|
| 96 |
+
|
| 97 |
+
DECLARE_DISPATCH(
|
| 98 |
+
dequantize_tensor_per_tensor_affine_fn,
|
| 99 |
+
dequantize_tensor_per_tensor_affine_stub)
|
| 100 |
+
DECLARE_DISPATCH(
|
| 101 |
+
dequantize_tensor_per_channel_affine_fn,
|
| 102 |
+
dequantize_tensor_per_channel_affine_stub)
|
| 103 |
+
DECLARE_DISPATCH(
|
| 104 |
+
dequantize_tensor_per_channel_float_qparams_fn,
|
| 105 |
+
dequantize_tensor_per_channel_float_qparams_stub)
|
| 106 |
+
|
| 107 |
+
DECLARE_DISPATCH(
|
| 108 |
+
quantize_tensor_per_tensor_affine_sub_byte_fn,
|
| 109 |
+
quantize_tensor_per_tensor_affine_sub_byte_stub)
|
| 110 |
+
|
| 111 |
+
DECLARE_DISPATCH(
|
| 112 |
+
dequantize_tensor_per_tensor_affine_sub_byte_fn,
|
| 113 |
+
dequantize_tensor_per_tensor_affine_sub_byte_stub)
|
| 114 |
+
|
| 115 |
+
template <typename T>
|
| 116 |
+
TORCH_API Tensor quantize_tensor(
|
| 117 |
+
Tensor rtensor,
|
| 118 |
+
Tensor qtensor,
|
| 119 |
+
double scale,
|
| 120 |
+
int64_t zero_point);
|
| 121 |
+
template <typename T>
|
| 122 |
+
TORCH_API Tensor dequantize_tensor(
|
| 123 |
+
Tensor qtensor,
|
| 124 |
+
Tensor rtensor,
|
| 125 |
+
double scale,
|
| 126 |
+
int64_t zero_point);
|
| 127 |
+
|
| 128 |
+
} // namespace at
|