aten/src/ATen/native/quantized/cudnn/Pooling.cpp
// The current implementation of quantized cuda adaptive average pooling uses the following:
// dequant -> fp32 adaptive average pooling -> quant. This is the same numerically as
// quantized adaptive average pooling. This is not the ideal implementation, as we desire to
// operate on the quantized values directly.
// However, we are currently blocked on this as we are waiting for cudnn's 8.5.0 release, which is anticipated
// to support adaptive average pooling. When that support is made available, we will use it directly. TODO
The current implementation of quantized cuda adaptive average pooling uses the following:
dequant -> fp32 adaptive average pooling -> quant. This is the same numerically as
quantized adaptive average pooling. This is not the ideal implementation, as we desire to
operate on the quantized values directly.
However, we are currently blocked on this as we are waiting for cudnn's 8.5.0 release, which is anticipated
to support adaptive average pooling. When that support is made available, we will use it directly. TODO
The current implementation of quantized cuda adaptive average pooling uses the following : dequant - > fp32 adaptive average pooling - > quant . This is the same numerically as quantized adaptive average pooling . This is not the ideal implementation as we desire to operate on the quantized values directly . However we are currently blocked on this as we are waiting for cudnn ' s 8 . 5 . 0 release which is anticipated to support adaptive average pooling . When that support is made available we will use it directly . TODO
Tensor adaptive_avg_pool2d_quantized_cuda(
    const at::Tensor& input,
    IntArrayRef output_size) {
#ifdef USE_CUDA
    TORCH_CHECK(input.qscheme() == at::kPerTensorAffine, "adaptive_avg_pool2d_quantized_cuda oonly supports per tensor quantized tensors");
    auto input_fp32 = at::dequantize(input);
    auto result_fp32 = at::adaptive_avg_pool2d(input_fp32, output_size);
    return at::quantize_per_tensor(result_fp32, input.q_scale(), input.q_zero_point(), input.scalar_type());
#else 
  AT_ERROR("at::native::adaptive_avg_pool2d_quantized_cuda: ATen not compiled with USE_CUDA support");
  return Tensor{}; 
#endif
}
Tensor adaptive_avg_pool2d_quantized_cuda ( const at :: Tensor & input , IntArrayRef output_size ) { #ifdef USE_CUDA TORCH_CHECK ( input . qscheme ( ) == at :: kPerTensorAffine , " " ) ; auto input_fp32 = at :: dequantize ( input ) ; auto result_fp32 = at :: adaptive_avg_pool2d ( input_fp32 , output_size ) ; return at :: quantize_per_tensor ( result_fp32 , input . q_scale ( ) , input . q_zero_point ( ) , input . scalar_type ( ) ) ; #else AT_ERROR ( " " ) ; return Tensor { } ; #endif }
The current implementation of quantized cuda adaptive average pooling uses the following:
dequant -> fp32 adaptive average pooling -> quant.
The current implementation of quantized cuda adaptive average pooling uses the following : dequant - > fp32 adaptive average pooling - > quant .
// TODO: renable these cudnn preprocessors like quantized_max_pool2d_cudnn below when we implement this function with cudnn // #if AT_CUDNN_ENABLED() // #if HAS_CUDNN_V8() // TODO: limit this to per tensor quantized tensors for now, though should be easy to adapt // to per channel quantized tensors // USE_CUDA // never reached, placates the compiler