Repository: pytorch
Issue: `torch.quantize_per_channel`: FPE 
Labels: module: crash,oncall: quantization

### 🐛 Describe the bug

`torch.quantize_per_channel` causes FPE with specific input.

Test code:
```python
import torch

input_temp = torch.randn([1,1,1,1,1], dtype=torch.float32)
scales = torch.randn((1), dtype=torch.float64)
zero_points = torch.randn((1), dtype=torch.float16)

torch.quantize_per_channel(input_temp, scales, zero_points, 0, dtype=torch.qint32)
```

Error log:
```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==541013==ERROR: AddressSanitizer: FPE on unknown address 0x7f828d51be7d (pc 0x7f828d51be7d bp 0x7ffc31a53f90 sp 0x7ffc31a53740 T0)
    #0 0x7f828d51be7d in at::native::(anonymous namespace)::quantize_tensor_per_channel_float_qparams_cpu(at::Tensor const&, at::Tensor&, at::Tensor const&, at::Tensor const&, long)::$_37::operator()() const::'lambda1'()::operator()() const /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/native/quantized/cpu/kernels/QuantizedOpKernels.cpp:4091:3
    #1 0x7f828d515b2b in at::native::(anonymous namespace)::quantize_tensor_per_channel_float_qparams_cpu(at::Tensor const&, at::Tensor&, at::Tensor const&, at::Tensor const&, long)::$_37::operator()() const /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/native/quantized/cpu/kernels/QuantizedOpKernels.cpp:4091:3
    #2 0x7f828d514661 in at::native::(anonymous namespace)::quantize_tensor_per_channel_float_qparams_cpu(at::Tensor const&, at::Tensor&, at::Tensor const&, at::Tensor const&, long) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/native/quantized/cpu/kernels/QuantizedOpKernels.cpp:4091:3
    #3 0x7f827a178416 in void at::native::DispatchStub<void (*)(at::Tensor const&, at::Tensor&, at::Tensor const&, at::Tensor const&, long), at::native::quantize_tensor_per_channel_float_qparams_stub>::operator()<at::Tensor const&, at::Tensor&, at::Tensor&, at::Tensor&, long&>(c10::DeviceType, at::Tensor const&, at::Tensor&, at::Tensor&, at::Tensor&, long&) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/native/DispatchStub.h:158:12
    #4 0x7f827a16c72a in at::native::quantize_tensor_per_channel_float_qparams(at::Tensor const&, at::Tensor&, at::Tensor, at::Tensor, long) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/native/quantized/AffineQuantizer.cpp:210:3
    #5 0x7f828195fabb in at::PerChannelAffineFloatQParamsQuantizer::quantize(at::Tensor const&) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/quantized/Quantizer.cpp:276:2
    #6 0x7f827a18e83c in at::native::quantize_per_channel(at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/native/quantized/QTensor.cpp:98:21
    #7 0x7f827e1a4ff5 in at::(anonymous namespace)::(anonymous namespace)::wrapper_CPU__quantize_per_channel(at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/build/aten/src/ATen/RegisterCPU.cpp:12865:10
    #8 0x7f827e1a5b9a in c10::impl::detail::WrapFunctionIntoFunctor_<c10::CompileTimeFunctionPointer<at::Tensor (at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType), &(at::(anonymous namespace)::(anonymous namespace)::wrapper_CPU__quantize_per_channel(at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType))>, at::Tensor, c10::guts::typelist::typelist<at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType> >::operator()(at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/boxing/impl/WrapFunctionIntoFunctor.h:13:16
    #9 0x7f827e1a5b9a in c10::impl::wrap_kernel_functor_unboxed_<c10::impl::detail::WrapFunctionIntoFunctor_<c10::CompileTimeFunctionPointer<at::Tensor (at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType), &(at::(anonymous namespace)::(anonymous namespace)::wrapper_CPU__quantize_per_channel(at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType))>, at::Tensor, c10::guts::typelist::typelist<at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType> >, at::Tensor (at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType)>::call(c10::OperatorKernel*, c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:468:14
    #10 0x7f827bb326a9 in at::Tensor c10::callUnboxedKernelFunction<at::Tensor, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType>(void*, c10::OperatorKernel*, c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long&&, c10::ScalarType&&) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/boxing/KernelFunction_impl.h:50:12
    #11 0x7f827bb320b5 in at::Tensor c10::KernelFunction::call<at::Tensor, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType>(c10::OperatorHandle const&, c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) const /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/boxing/KernelFunction_impl.h:102:16
    #12 0x7f827bb320b5 in at::Tensor c10::Dispatcher::redispatch<at::Tensor, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType>(c10::TypedOperatorHandle<at::Tensor (at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType)> const&, c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) const /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/dispatch/Dispatcher.h:712:26
    #13 0x7f827b96fa7b in c10::TypedOperatorHandle<at::Tensor (at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType)>::redispatch(c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) const /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/dispatch/Dispatcher.h:532:41
    #14 0x7f827b96fa7b in at::_ops::quantize_per_channel::redispatch(c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/build/aten/src/ATen/Operators_1.cpp:6404:15
    #15 0x7f828664189d in at::redispatch::quantize_per_channel(c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/build/aten/src/ATen/RedispatchFunctions.h:9037:16
    #16 0x7f828643c4bb in torch::autograd::VariableType::(anonymous namespace)::quantize_per_channel(c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType)::$_119::operator()() const /home/yonghyeon/pytorch/pytorch-asan/torch/csrc/autograd/generated/VariableType_1.cpp:12344:12
    #17 0x7f828643b498 in torch::autograd::VariableType::(anonymous namespace)::quantize_per_channel(c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/torch/csrc/autograd/generated/VariableType_1.cpp:12342:15
    #18 0x7f828643d08d in c10::impl::detail::WrapFunctionIntoFunctor_<c10::CompileTimeFunctionPointer<at::Tensor (c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType), &(torch::autograd::VariableType::(anonymous namespace)::quantize_per_channel(c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType))>, at::Tensor, c10::guts::typelist::typelist<c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType> >::operator()(c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/boxing/impl/WrapFunctionIntoFunctor.h:13:16
    #19 0x7f828643d08d in c10::impl::wrap_kernel_functor_unboxed_<c10::impl::detail::WrapFunctionIntoFunctor_<c10::CompileTimeFunctionPointer<at::Tensor (c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType), &(torch::autograd::VariableType::(anonymous namespace)::quantize_per_channel(c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType))>, at::Tensor, c10::guts::typelist::typelist<c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType> >, at::Tensor (c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType)>::call(c10::OperatorKernel*, c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:485:14
    #20 0x7f827bb326a9 in at::Tensor c10::callUnboxedKernelFunction<at::Tensor, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType>(void*, c10::OperatorKernel*, c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long&&, c10::ScalarType&&) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/boxing/KernelFunction_impl.h:50:12
    #21 0x7f827b670cf9 in at::Tensor c10::KernelFunction::call<at::Tensor, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType>(c10::OperatorHandle const&, c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) const /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/boxing/KernelFunction_impl.h:102:16
    #22 0x7f827b670cf9 in at::Tensor c10::Dispatcher::call<at::Tensor, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType>(c10::TypedOperatorHandle<at::Tensor (at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType)> const&, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) const /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/dispatch/Dispatcher.h:694:28
    #23 0x7f827b670cf9 in c10::TypedOperatorHandle<at::Tensor (at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType)>::call(at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) const /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/dispatch/Dispatcher.h:527:41
    #24 0x7f827b670cf9 in at::_ops::quantize_per_channel::call(at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/build/aten/src/ATen/Operators_1.cpp:6397:15
    #25 0x7f82a30cee75 in at::quantize_per_channel(at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/build/aten/src/ATen/ops/quantize_per_channel.h:27:12
    #26 0x7f82a308ba64 in torch::autograd::THPVariable_quantize_per_channel(_object*, _object*, _object*)::$_318::operator()(at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) const /home/yonghyeon/pytorch/pytorch-asan/torch/csrc/autograd/generated/python_torch_functions_1.cpp:7200:12
    #27 0x7f82a2fe749e in torch::autograd::THPVariable_quantize_per_channel(_object*, _object*, _object*) /home/yonghyeon/pytorch/pytorch-asan/torch/csrc/autograd/generated/python_torch_functions_1.cpp:7202:15
    #28 0x54f023 in cfunction_call /usr/local/src/conda/python-3.12.0/Objects/methodobject.c:537:18
    #29 0x51d27a in _PyObject_MakeTpCall.localalias /usr/local/src/conda/python-3.12.0/Objects/call.c:240:18
    #30 0x5295b9 in _PyEval_EvalFrameDefault /croot/python-split_1696267002197/work/build-static/Python/bytecodes.c:2711:19
    #31 0x5f450d in PyEval_EvalCode /usr/local/src/conda/python-3.12.0/Python/ceval.c:570:21
    #32 0x6198b6 in run_eval_code_obj /usr/local/src/conda/python-3.12.0/Python/pythonrun.c:1693
    #33 0x614d36 in run_mod /usr/local/src/conda/python-3.12.0/Python/pythonrun.c:1714
    #34 0x62a931 in pyrun_file /usr/local/src/conda/python-3.12.0/Python/pythonrun.c:1614
    #35 0x62a28f in _PyRun_SimpleFileObject.localalias /usr/local/src/conda/python-3.12.0/Python/pythonrun.c:433
    #36 0x62a082 in _PyRun_AnyFileObject.localalias /usr/local/src/conda/python-3.12.0/Python/pythonrun.c:78
    #37 0x624273 in pymain_run_file_obj /usr/local/src/conda/python-3.12.0/Modules/main.c:360
    #38 0x624273 in pymain_run_file /usr/local/src/conda/python-3.12.0/Modules/main.c:379
    #39 0x624273 in pymain_run_python /usr/local/src/conda/python-3.12.0/Modules/main.c:610
    #40 0x624273 in Py_RunMain.localalias /usr/local/src/conda/python-3.12.0/Modules/main.c:689
    #41 0x5dfbb8 in Py_BytesMain /usr/local/src/conda/python-3.12.0/Modules/main.c:743:12
error: failed to decompress '.debug_aranges', zlib is not available
error: failed to decompress '.debug_info', zlib is not available
error: failed to decompress '.debug_abbrev', zlib is not available
error: failed to decompress '.debug_line', zlib is not available
error: failed to decompress '.debug_str', zlib is not available
error: failed to decompress '.debug_line_str', zlib is not available
error: failed to decompress '.debug_loclists', zlib is not available
error: failed to decompress '.debug_rnglists', zlib is not available
    #42 0x7f82b3601d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
    #43 0x7f82b3601e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
    #44 0x5df9ed in _start (/home/yonghyeon/anaconda3/envs/torch-asan/bin/python3.12+0x5df9ed)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: FPE /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/native/quantized/cpu/kernels/QuantizedOpKernels.cpp:4091:3 in at::native::(anonymous namespace)::quantize_tensor_per_channel_float_qparams_cpu(at::Tensor const&, at::Tensor&, at::Tensor const&, at::Tensor const&, long)::$_37::operator()() const::'lambda1'()::operator()() const
==541013==ABORTING
```

Test code (c++):
```cpp
#include <torch/torch.h>

int main() {
  torch::TensorOptions toptions = torch::TensorOptions();

  torch::Tensor input_temp = torch::randn({1,1,1,1,1}, toptions.dtype(torch::kFloat32));
  torch::Tensor scales = torch::randn({1}, toptions.dtype(torch::kFloat64));
  torch::Tensor zero_points = torch::randn({1}, toptions.dtype(torch::kFloat16));

  at::quantize_per_channel(input_temp, scales, zero_points, 0, c10::kQInt32);

  return 0;
}
```

Error log:
```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==541656==ERROR: AddressSanitizer: FPE on unknown address 0x7f4aac9bce7d (pc 0x7f4aac9bce7d bp 0x7ffdd75f30f0 sp 0x7ffdd75f28a0 T0)
    #0 0x7f4aac9bce7d in at::native::(anonymous namespace)::quantize_tensor_per_channel_float_qparams_cpu(at::Tensor const&, at::Tensor&, at::Tensor const&, at::Tensor const&, long)::$_37::operator()() const::'lambda1'()::operator()() const /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/native/quantized/cpu/kernels/QuantizedOpKernels.cpp:4091:3
    #1 0x7f4aac9b6b2b in at::native::(anonymous namespace)::quantize_tensor_per_channel_float_qparams_cpu(at::Tensor const&, at::Tensor&, at::Tensor const&, at::Tensor const&, long)::$_37::operator()() const /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/native/quantized/cpu/kernels/QuantizedOpKernels.cpp:4091:3
    #2 0x7f4aac9b5661 in at::native::(anonymous namespace)::quantize_tensor_per_channel_float_qparams_cpu(at::Tensor const&, at::Tensor&, at::Tensor const&, at::Tensor const&, long) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/native/quantized/cpu/kernels/QuantizedOpKernels.cpp:4091:3
    #3 0x7f4a99619416 in void at::native::DispatchStub<void (*)(at::Tensor const&, at::Tensor&, at::Tensor const&, at::Tensor const&, long), at::native::quantize_tensor_per_channel_float_qparams_stub>::operator()<at::Tensor const&, at::Tensor&, at::Tensor&, at::Tensor&, long&>(c10::DeviceType, at::Tensor const&, at::Tensor&, at::Tensor&, at::Tensor&, long&) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/native/DispatchStub.h:158:12
    #4 0x7f4a9960d72a in at::native::quantize_tensor_per_channel_float_qparams(at::Tensor const&, at::Tensor&, at::Tensor, at::Tensor, long) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/native/quantized/AffineQuantizer.cpp:210:3
    #5 0x7f4aa0e00abb in at::PerChannelAffineFloatQParamsQuantizer::quantize(at::Tensor const&) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/quantized/Quantizer.cpp:276:2
    #6 0x7f4a9962f83c in at::native::quantize_per_channel(at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/native/quantized/QTensor.cpp:98:21
    #7 0x7f4a9d645ff5 in at::(anonymous namespace)::(anonymous namespace)::wrapper_CPU__quantize_per_channel(at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/build/aten/src/ATen/RegisterCPU.cpp:12865:10
    #8 0x7f4a9d646b9a in c10::impl::detail::WrapFunctionIntoFunctor_<c10::CompileTimeFunctionPointer<at::Tensor (at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType), &(at::(anonymous namespace)::(anonymous namespace)::wrapper_CPU__quantize_per_channel(at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType))>, at::Tensor, c10::guts::typelist::typelist<at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType> >::operator()(at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/boxing/impl/WrapFunctionIntoFunctor.h:13:16
    #9 0x7f4a9d646b9a in c10::impl::wrap_kernel_functor_unboxed_<c10::impl::detail::WrapFunctionIntoFunctor_<c10::CompileTimeFunctionPointer<at::Tensor (at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType), &(at::(anonymous namespace)::(anonymous namespace)::wrapper_CPU__quantize_per_channel(at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType))>, at::Tensor, c10::guts::typelist::typelist<at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType> >, at::Tensor (at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType)>::call(c10::OperatorKernel*, c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:468:14
    #10 0x7f4a9afd36a9 in at::Tensor c10::callUnboxedKernelFunction<at::Tensor, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType>(void*, c10::OperatorKernel*, c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long&&, c10::ScalarType&&) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/boxing/KernelFunction_impl.h:50:12
    #11 0x7f4a9afd30b5 in at::Tensor c10::KernelFunction::call<at::Tensor, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType>(c10::OperatorHandle const&, c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) const /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/boxing/KernelFunction_impl.h:102:16
    #12 0x7f4a9afd30b5 in at::Tensor c10::Dispatcher::redispatch<at::Tensor, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType>(c10::TypedOperatorHandle<at::Tensor (at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType)> const&, c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) const /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/dispatch/Dispatcher.h:712:26
    #13 0x7f4a9ae10a7b in c10::TypedOperatorHandle<at::Tensor (at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType)>::redispatch(c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) const /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/dispatch/Dispatcher.h:532:41
    #14 0x7f4a9ae10a7b in at::_ops::quantize_per_channel::redispatch(c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/build/aten/src/ATen/Operators_1.cpp:6404:15
    #15 0x7f4aa5ae289d in at::redispatch::quantize_per_channel(c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/build/aten/src/ATen/RedispatchFunctions.h:9037:16
    #16 0x7f4aa58dd4bb in torch::autograd::VariableType::(anonymous namespace)::quantize_per_channel(c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType)::$_119::operator()() const /home/yonghyeon/pytorch/pytorch-asan/torch/csrc/autograd/generated/VariableType_1.cpp:12344:12
    #17 0x7f4aa58dc498 in torch::autograd::VariableType::(anonymous namespace)::quantize_per_channel(c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/torch/csrc/autograd/generated/VariableType_1.cpp:12342:15
    #18 0x7f4aa58de08d in c10::impl::detail::WrapFunctionIntoFunctor_<c10::CompileTimeFunctionPointer<at::Tensor (c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType), &(torch::autograd::VariableType::(anonymous namespace)::quantize_per_channel(c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType))>, at::Tensor, c10::guts::typelist::typelist<c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType> >::operator()(c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/boxing/impl/WrapFunctionIntoFunctor.h:13:16
    #19 0x7f4aa58de08d in c10::impl::wrap_kernel_functor_unboxed_<c10::impl::detail::WrapFunctionIntoFunctor_<c10::CompileTimeFunctionPointer<at::Tensor (c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType), &(torch::autograd::VariableType::(anonymous namespace)::quantize_per_channel(c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType))>, at::Tensor, c10::guts::typelist::typelist<c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType> >, at::Tensor (c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType)>::call(c10::OperatorKernel*, c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:485:14
    #20 0x7f4a9afd36a9 in at::Tensor c10::callUnboxedKernelFunction<at::Tensor, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType>(void*, c10::OperatorKernel*, c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long&&, c10::ScalarType&&) /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/boxing/KernelFunction_impl.h:50:12
    #21 0x7f4a9ab11cf9 in at::Tensor c10::KernelFunction::call<at::Tensor, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType>(c10::OperatorHandle const&, c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) const /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/boxing/KernelFunction_impl.h:102:16
    #22 0x7f4a9ab11cf9 in at::Tensor c10::Dispatcher::call<at::Tensor, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType>(c10::TypedOperatorHandle<at::Tensor (at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType)> const&, at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) const /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/dispatch/Dispatcher.h:694:28
    #23 0x7f4a9ab11cf9 in c10::TypedOperatorHandle<at::Tensor (at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType)>::call(at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) const /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/core/dispatch/Dispatcher.h:527:41
    #24 0x7f4a9ab11cf9 in at::_ops::quantize_per_channel::call(at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/build/aten/src/ATen/Operators_1.cpp:6397:15
    #25 0x407185 in at::quantize_per_channel(at::Tensor const&, at::Tensor const&, at::Tensor const&, long, c10::ScalarType) /home/yonghyeon/pytorch/pytorch-asan/build/aten/src/ATen/ops/quantize_per_channel.h:27:12
    #26 0x40528a in main /home/yonghyeon/pytorch/pytorch-asan/test/cpp/reproduce/quantize_per_channel.cpp:10:3
error: failed to decompress '.debug_aranges', zlib is not available
error: failed to decompress '.debug_info', zlib is not available
error: failed to decompress '.debug_abbrev', zlib is not available
error: failed to decompress '.debug_line', zlib is not available
error: failed to decompress '.debug_str', zlib is not available
error: failed to decompress '.debug_line_str', zlib is not available
error: failed to decompress '.debug_loclists', zlib is not available
error: failed to decompress '.debug_rnglists', zlib is not available
    #27 0x7f4a8a04dd8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
    #28 0x7f4a8a04de3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
    #29 0x404434 in _start (/home/yonghyeon/pytorch/pytorch-asan/build/bin/reproduce_quantize_per_channel+0x404434)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: FPE /home/yonghyeon/pytorch/pytorch-asan/aten/src/ATen/native/quantized/cpu/kernels/QuantizedOpKernels.cpp:4091:3 in at::native::(anonymous namespace)::quantize_tensor_per_channel_float_qparams_cpu(at::Tensor const&, at::Tensor&, at::Tensor const&, at::Tensor const&, long)::$_37::operator()() const::'lambda1'()::operator()() const
==541656==ABORTING
```

### Versions

PyTorch version: 2.3.0a0+git1ee7950
Is debug build: True
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.2 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: 12.0.1
CMake version: version 3.26.4
Libc version: glibc-2.35

Python version: 3.12.0 | packaged by Anaconda, Inc. | (main, Oct  2 2023, 17:29:18) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-89-generic-x86_64-with-glibc2.35
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                       x86_64
CPU op-mode(s):                     32-bit, 64-bit
Address sizes:                      46 bits physical, 48 bits virtual
Byte Order:                         Little Endian
CPU(s):                             96
On-line CPU(s) list:                0-95
Vendor ID:                          GenuineIntel
Model name:                         Intel(R) Xeon(R) Gold 6248R CPU @ 3.00GHz
CPU family:                         6
Model:                              85
Thread(s) per core:                 2
Core(s) per socket:                 24
Socket(s):                          2
Stepping:                           7
CPU max MHz:                        4000.0000
CPU min MHz:                        1200.0000
BogoMIPS:                           6000.00
Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts pku ospke avx512_vnni md_clear flush_l1d arch_capabilities
Virtualization:                     VT-x
L1d cache:                          1.5 MiB (48 instances)
L1i cache:                          1.5 MiB (48 instances)
L2 cache:                           48 MiB (48 instances)
L3 cache:                           71.5 MiB (2 instances)
NUMA node(s):                       2
NUMA node0 CPU(s):                  0-23,48-71
NUMA node1 CPU(s):                  24-47,72-95
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Itlb multihit:        KVM: Mitigation: VMX disabled
Vulnerability L1tf:                 Not affected
Vulnerability Mds:                  Not affected
Vulnerability Meltdown:             Not affected
Vulnerability Mmio stale data:      Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed:             Mitigation; Enhanced IBRS
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Mitigation; TSX disabled

Versions of relevant libraries:
[pip3] numpy==1.26.2
[pip3] optree==0.10.0
[pip3] torch==2.3.0a0+git1ee7950
[conda] mkl                       2023.1.0         h213fc3f_46344  
[conda] mkl-include               2023.1.0         h06a4308_46344  
[conda] numpy                     1.26.2                   pypi_0    pypi
[conda] optree                    0.10.0                   pypi_0    pypi
[conda] torch                     2.3.0a0+git1ee7950           dev_0    <develop>

cc @jerryzh168 @jianyuh @raghuramank100 @jamesr66a @vkuzo @jgong5 @Xia-Weiwen @leslie-fang-intel