From 37a7b6eb428a93174b5f6aba7afaa7cf982932d5 Mon Sep 17 00:00:00 2001 From: liubuyu Date: Thu, 30 Jul 2020 18:13:51 +0800 Subject: [PATCH] fix get/set reshape_type bug --- .../ccsrc/backend/kernel_compiler/kernel_build_info.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mindspore/ccsrc/backend/kernel_compiler/kernel_build_info.cc b/mindspore/ccsrc/backend/kernel_compiler/kernel_build_info.cc index 38af0f87eb..908c8427f7 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/kernel_build_info.cc +++ b/mindspore/ccsrc/backend/kernel_compiler/kernel_build_info.cc @@ -65,6 +65,9 @@ size_t KernelBuildInfo::GetInputNum() const { return inputs_format_.size(); } size_t KernelBuildInfo::GetOutputNum() const { return outputs_format_.size(); } std::vector KernelBuildInfo::GetInputReshapeType(size_t input_index) const { + if (input_reshape_type_.empty()) { + return {}; + } if (input_index >= input_reshape_type_.size()) { MS_LOG(EXCEPTION) << "The index [" << input_index << "] is exceed the number of input node size " << input_reshape_type_.size(); @@ -73,6 +76,9 @@ std::vector KernelBuildInfo::GetInputReshapeType(size_t input_index) const } std::vector KernelBuildInfo::GetOutputReshapeType(size_t output_index) const { + if (output_reshape_type_.empty()) { + return {}; + } if (output_index >= output_reshape_type_.size()) { MS_LOG(EXCEPTION) << "The index [" << output_index << "] is exceed the number of output node size " << output_reshape_type_.size();