Check dynamic support.

pull/1077/head
unknown 4 years ago
parent 16c2f091b7
commit 21649a2852

@ -624,6 +624,7 @@ namespace {
Status CheckDynamicSupport(GeModelPtr &ge_model, const ComputeGraphPtr &graph) { Status CheckDynamicSupport(GeModelPtr &ge_model, const ComputeGraphPtr &graph) {
bool support_dynamic = true; bool support_dynamic = true;
bool is_dynamic = false;
for (const auto &node : graph->GetDirectNode()) { for (const auto &node : graph->GetDirectNode()) {
GE_CHECK_NOTNULL(node); GE_CHECK_NOTNULL(node);
if (node->GetType() == DATA || node->GetType() == CONSTANT || node->GetType() == CONSTANTOP || if (node->GetType() == DATA || node->GetType() == CONSTANT || node->GetType() == CONSTANTOP ||
@ -632,12 +633,17 @@ namespace {
} }
auto op_desc = node->GetOpDesc(); auto op_desc = node->GetOpDesc();
GE_CHECK_NOTNULL(op_desc); GE_CHECK_NOTNULL(op_desc);
if (AttrUtils::HasAttr(op_desc, kAttrSupportDynamicShape)) {
is_dynamic = true;
(void) AttrUtils::GetBool(op_desc, kAttrSupportDynamicShape, support_dynamic); (void) AttrUtils::GetBool(op_desc, kAttrSupportDynamicShape, support_dynamic);
if (!support_dynamic) { if (!support_dynamic) {
GELOGW("Node[%s] doesn't support dynamic shape.", node->GetName().c_str()); GELOGW("Node[%s] doesn't support dynamic shape.", node->GetName().c_str());
(void)AttrUtils::SetBool(ge_model, kAttrSupportDynamicShape, false); break;
return SUCCESS; }
}
} }
if (is_dynamic) {
(void) AttrUtils::SetBool(ge_model, kAttrSupportDynamicShape, support_dynamic);
} }
return SUCCESS; return SUCCESS;
} }

Loading…
Cancel
Save