fix_bug_of_dynamic_shape_with_ms_function

This commit is contained in:
7347157+joylvliang@user.noreply.gitee.com 2021-09-07 19:18:21 +08:00
parent 394dfc07bc
commit 8f08bc281c
1 changed files with 2 additions and 1 deletions

View File

@ -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<size_t>(input_shape[i]) != param_shape[i]) {
if (input_shape[i] < 0 || (static_cast<size_t>(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();
}