From 5f6ec8ea6d23abfeeda0ad185291d92fa40a046f Mon Sep 17 00:00:00 2001 From: Changming Sun Date: Wed, 25 Mar 2020 14:58:23 -0700 Subject: [PATCH] Fix a bug in Maxpool v8 --- onnxruntime/core/providers/cpu/nn/pool_attributes.h | 9 ++++----- onnxruntime/core/providers/cpu/nn/pool_base.h | 4 +--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/onnxruntime/core/providers/cpu/nn/pool_attributes.h b/onnxruntime/core/providers/cpu/nn/pool_attributes.h index 832d3adbeb..3a3826f3d8 100644 --- a/onnxruntime/core/providers/cpu/nn/pool_attributes.h +++ b/onnxruntime/core/providers/cpu/nn/pool_attributes.h @@ -17,8 +17,8 @@ struct PoolAttributes { } PoolAttributes(const OpNodeProtoHelper& info, - const std::string& op_name, int start_ver_p) - : global_pooling(IsGlobalPooling(op_name)), start_version(start_ver_p) { + const std::string& op_name, int start_version) + : global_pooling(IsGlobalPooling(op_name)) { if (global_pooling) { return; } @@ -57,8 +57,8 @@ struct PoolAttributes { } if (op_name == "MaxPool") { - if (start_version == 8) { - storage_order = info.GetAttrOrDefault("storage_order", 0 /*default_value*/); + if (start_version >= 8) { + ORT_ENFORCE(info.GetAttr("storage_order", &storage_order).IsOK()); } } @@ -74,7 +74,6 @@ struct PoolAttributes { } const bool global_pooling; - const int start_version; bool count_include_pad{}; int64_t storage_order{0}; // MaxPool_8 only. 0 is row major, and 1 is column major. Default is 0. diff --git a/onnxruntime/core/providers/cpu/nn/pool_base.h b/onnxruntime/core/providers/cpu/nn/pool_base.h index de6b7b3073..4aa86c7c15 100644 --- a/onnxruntime/core/providers/cpu/nn/pool_base.h +++ b/onnxruntime/core/providers/cpu/nn/pool_base.h @@ -101,9 +101,7 @@ class LpPool { class PoolBase { private: static int GetStartVersion(const OpKernelInfo& info) { - int start, end; - info.GetKernelDef().SinceVersion(&start, &end); - return start; + return info.node().Op()->since_version(); } protected: