From 8f908ae0cf83847ed71297efe000b98b611db979 Mon Sep 17 00:00:00 2001 From: baihuawei Date: Tue, 15 Dec 2020 18:44:17 +0800 Subject: [PATCH] fix cpu select op type --- .../ccsrc/backend/kernel_compiler/cpu/reduce_cpu_kernel.cc | 2 +- mindspore/ccsrc/runtime/device/cpu/kernel_select_cpu.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/reduce_cpu_kernel.cc b/mindspore/ccsrc/backend/kernel_compiler/cpu/reduce_cpu_kernel.cc index 32bc5926c3..6af697ba24 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/reduce_cpu_kernel.cc +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/reduce_cpu_kernel.cc @@ -92,7 +92,7 @@ bool ReduceCPUKernel::Launch(const std::vector &inputs, void ReduceCPUKernel::CheckAxis(const CNodePtr &kernel_node) { auto axis_addr = AnfAlgo::GetCNodePrimitive(kernel_node)->GetAttr(AXIS); - if (axis_addr->isa()) { + if (axis_addr->isa() || axis_addr->isa()) { std::vector attr_axis; std::vector attr_axis_me = AnfAlgo::GetNodeAttr>(kernel_node, AXIS); (void)std::transform(attr_axis_me.begin(), attr_axis_me.end(), std::back_inserter(attr_axis), diff --git a/mindspore/ccsrc/runtime/device/cpu/kernel_select_cpu.cc b/mindspore/ccsrc/runtime/device/cpu/kernel_select_cpu.cc index 3a0c31f365..88bf20e2d0 100644 --- a/mindspore/ccsrc/runtime/device/cpu/kernel_select_cpu.cc +++ b/mindspore/ccsrc/runtime/device/cpu/kernel_select_cpu.cc @@ -272,8 +272,8 @@ bool SelectKernel(const CNodePtr &kernel_node, KernelAttr *selected_kernel_attr, } } // All formats and data types matched - if (max_type_matched_num == SizeToInt(input_types.size()) && - max_format_matched_num == SizeToInt(input_types.size())) { + if (input_type_format_matched_num.first == SizeToInt(input_types.size()) && + input_type_format_matched_num.second == SizeToInt(input_types.size())) { matched->first = true; if (output_type_format_matched_num.first == SizeToInt(infer_output_types.size()) && output_type_format_matched_num.second == SizeToInt(infer_output_types.size())) {