Browse Source

!1490 fix optional input bug

From: @wan_xuelei
Reviewed-by: @xchu42,@wqtshg
Signed-off-by: @lbisdaddy
tags/v1.2.0
mindspore-ci-bot Gitee 4 years ago
parent
commit
99e607c6d1
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      ge/generator/ge_generator.cc

+ 5
- 1
ge/generator/ge_generator.cc View File

@@ -67,6 +67,9 @@ bool ContainsDynamicInpus(const ge::OpDesc &op_desc) {
}
return false;
}
bool IsOptional(const ge::GeTensorDesc &tensor_desc) {
return tensor_desc.GetFormat() == ge::FORMAT_RESERVED && tensor_desc.GetDataType() == ge::DT_UNDEFINED;
}
} // namespace

namespace ge {
@@ -715,7 +718,8 @@ void GeGenerator::RemoveConst(const vector<GeTensor> &inputs, vector<GeTensor> &
GeTensorDesc input_desc = input.GetTensorDesc();
bool is_const = false;
(void)AttrUtils::GetBool(input_desc, CONST_ATTR_NAME_INPUT, is_const);
if (!is_const) {
bool is_optional = IsOptional(input_desc);
if (!is_optional && !is_const) {
outputs.emplace_back(input);
}
}


Loading…
Cancel
Save