Browse Source

For dynamic shape complie.

pull/656/head
unknown 5 years ago
parent
commit
a1f23dd1d0
1 changed files with 6 additions and 8 deletions
  1. +6
    -8
      ge/graph/build/graph_builder.cc

+ 6
- 8
ge/graph/build/graph_builder.cc View File

@@ -198,10 +198,8 @@ Status GraphBuilder::Build(ComputeGraphPtr &comp_graph, std::vector<SubGraphInfo
return MEMALLOC_FAILED;
}
GeModelPtr ge_model_ptr = nullptr;
bool is_dynamic_shape = false;
// To be compatible with the old process, do not verify the return value temporarily.
(void)AttrUtils::GetBool(comp_graph, ATTR_NAME_DYNAMIC_SHAPE_PARTITIONED, is_dynamic_shape);
if (is_dynamic_shape) {
if (comp_graph->GetGraphUnknownFlag()) {
GE_CHK_STATUS_RET(
BuildForDynamicShapeGraph(comp_graph, subgraph_ptr_list, ge_root_model_ptr, ge_model_ptr, session_id),
"Build for dynamic shape graph failed.");
@@ -290,7 +288,7 @@ Status GraphBuilder::BuildForUnknownShapeGraph(ComputeGraphPtr &comp_graph, GeMo
GE_DUMP(comp_graph, "AfterCalcOpParam");


for (auto &node : comp_graph->GetsDirectNode()) {
for (auto &node : comp_graph->GetsDirectNode()) {
GE_CHECK_NOTNULL(node);
auto op_desc = node->GetOpDesc();
GE_CHECK_NOTNULL(op_desc);
@@ -313,8 +311,8 @@ Status GraphBuilder::BuildForUnknownShapeGraph(ComputeGraphPtr &comp_graph, GeMo
continue;
}

std::vector<GeTensorPtr> weight = OpDescUtils::MutableWeights(peer_node);
if (weight.empty()) {
std::vector<GeTensorPtr> weights = OpDescUtils::MutableWeights(peer_node);
if (weights.empty()) {
GELOGE(FAILED, "weights size of node %s is empty", node->GetName().c_str());
return FAILED;
}
@@ -322,7 +320,7 @@ Status GraphBuilder::BuildForUnknownShapeGraph(ComputeGraphPtr &comp_graph, GeMo
GE_CHECK_NOTNULL(weight);
int64_t input_offset = 0;
(void) TensorUtils::GetDataOffset(weight->MutableTensorDesc(), input_offset);
input_offsetp[valid_input_index] = input_offset;
input_offsets[valid_input_index] = input_offset;
GELOGD("[%s] input[%u] is const, offset = %ld", node->GetName().c_str(), valid_input_index, input_offset);
}



Loading…
Cancel
Save