From 8f08bc281c12bab3554af3462ec1b9919ebb83a0 Mon Sep 17 00:00:00 2001 From: "7347157+joylvliang@user.noreply.gitee.com" Date: Tue, 7 Sep 2021 19:18:21 +0800 Subject: [PATCH] fix_bug_of_dynamic_shape_with_ms_function --- mindspore/ccsrc/backend/session/session_basic.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mindspore/ccsrc/backend/session/session_basic.cc b/mindspore/ccsrc/backend/session/session_basic.cc index 52b884de930..fe78593a93e 100644 --- a/mindspore/ccsrc/backend/session/session_basic.cc +++ b/mindspore/ccsrc/backend/session/session_basic.cc @@ -1251,8 +1251,9 @@ void SessionBasic::GetParameterIndex(const KernelGraph *graph, const std::vector MS_LOG(EXCEPTION) << "Shapes of input and parameter are different, input index: " << index << ", parameter: " << param->fullname_with_scope(); } + bool is_dynamic = param->Shape()->IsDynamic(); for (size_t i = 0; i < input_shape.size(); i += 1) { - if (input_shape[i] < 0 || static_cast(input_shape[i]) != param_shape[i]) { + if (input_shape[i] < 0 || (static_cast(input_shape[i]) != param_shape[i] && !is_dynamic)) { MS_LOG(EXCEPTION) << "Shapes of input and parameter are different, input index: " << index << ", parameter: " << param->fullname_with_scope(); }