diff --git a/onnxruntime/core/providers/cpu/nn/conv_transpose.h b/onnxruntime/core/providers/cpu/nn/conv_transpose.h index 49c174969b38b..3e42f1337c1a7 100644 --- a/onnxruntime/core/providers/cpu/nn/conv_transpose.h +++ b/onnxruntime/core/providers/cpu/nn/conv_transpose.h @@ -25,7 +25,14 @@ namespace onnxruntime { template class ConvTranspose : public OpKernel { public: - ConvTranspose(const OpKernelInfo& info) : OpKernel(info), conv_transpose_attrs_(info) {} + ConvTranspose(const OpKernelInfo& info) : OpKernel(info), conv_transpose_attrs_(info) { + if (auto_pad == AutoPadType::SAME_UPPER || auto_pad == AutoPadType::SAME_LOWER) { + // TODO(jcwchen): #9740 ORT 1.13 will correct the logic by switching them to meet ONNX spec + LOGS_DEFAULT(WARNING) << "The existing bug in the padding distribution for auto_pad type" + << " SAME_UPPER/SAME_LOWER will be fixed in next ORT 1.13 release and hence the" + << " results of ConvTranspose operator using the above auto_pad type(s) will be different."; + } + } Status PrePack(const Tensor& tensor, int input_idx, AllocatorPtr alloc, /*out*/ bool& is_packed, diff --git a/onnxruntime/core/providers/cpu/nn/conv_transpose_attributes.h b/onnxruntime/core/providers/cpu/nn/conv_transpose_attributes.h index 01b25e4b5cb67..ee74877da8d86 100644 --- a/onnxruntime/core/providers/cpu/nn/conv_transpose_attributes.h +++ b/onnxruntime/core/providers/cpu/nn/conv_transpose_attributes.h @@ -176,17 +176,11 @@ struct ConvTransposeAttributes : public ConvAttributes { void DistributePadding(AutoPadType pad_type, const int64_t& total_pad, int64_t& pad_head, int64_t& pad_tail) const { - if (pad_type == AutoPadType::SAME_UPPER || pad_type == AutoPadType::SAME_LOWER) { - // TODO(jcwchen): #9740 ORT 1.13 will correct the logic by switching them to meet ONNX spec - LOGS_DEFAULT(WARNING) << "The existing bug in the padding distribution for auto_pad type" - << " SAME_UPPER/SAME_LOWER will be fixed in next ORT 1.13 release and hence the" - << " results of ConvTranspose operator using the above auto_pad type(s) will be different."; - } if (pad_type == AutoPadType::SAME_UPPER) { // pad more on head when total_pad is odd. pad_head = total_pad - total_pad / 2; pad_tail = total_pad / 2; } else { - // for pad_type is SAME_LOWER + // for pad_type is NOTSET, SAME_LOWER or VALID // set pad_head as total_pad/2, pad_tail as total_pad-total_pad/2. // That said, we pad more on tail when total_pad is odd. pad_head = total_pad / 2;