From 0d35f0e2c05ed003f22b1383223a9604f594ea33 Mon Sep 17 00:00:00 2001 From: Guoyu Wang <62914304+gwang-msft@users.noreply.github.com> Date: Thu, 4 Feb 2021 00:30:10 -0800 Subject: [PATCH] [CoreML EP] Add support of Conv operator (#6510) * [CoreML EP] Add support of Conv operator * Ignore an corner case setting empty padding * Add handle autopadding * Addressed CR comments --- onnxruntime/core/providers/common.h | 3 +- .../builders/impl/activation_op_builder.cc | 6 +- .../coreml/builders/impl/base_op_builder.cc | 14 +- .../coreml/builders/impl/base_op_builder.h | 2 + .../coreml/builders/impl/binary_op_builder.cc | 3 +- .../coreml/builders/impl/builder_utils.cc | 70 ++++++++ .../coreml/builders/impl/builder_utils.h | 11 ++ .../coreml/builders/impl/conv_op_builder.cc | 154 ++++++++++++++++++ .../builders/impl/transpose_op_builder.cc | 3 +- .../coreml/builders/op_builder_factory.cc | 4 + .../coreml/builders/op_builder_factory.h | 1 + .../nnapi_lib/NeuralNetworksWrapper.cc | 6 +- .../core/providers/shared/utils/utils.cc | 7 + .../core/providers/shared/utils/utils.h | 7 +- .../test/providers/cpu/nn/conv_op_test.cc | 12 +- 15 files changed, 278 insertions(+), 25 deletions(-) create mode 100644 onnxruntime/core/providers/coreml/builders/impl/conv_op_builder.cc diff --git a/onnxruntime/core/providers/common.h b/onnxruntime/core/providers/common.h index 17dfb39a3f..3688133c6d 100644 --- a/onnxruntime/core/providers/common.h +++ b/onnxruntime/core/providers/common.h @@ -140,9 +140,10 @@ inline bool Contains(const Map& map, const Key& key) { return map.find(key) != map.end(); } +// Note: This helper function will not have overflow protection template