|
|
|
@@ -105,7 +105,7 @@ domi::Status ComputeArgRange(const domi::tensorflow::NodeDef &node_def, const do |
|
|
|
REPORT_INNER_ERROR("E19999", "Attr:type_list_attr not exist in node:%s, check invalid", node_def.name().c_str()); |
|
|
|
return domi::INTERNAL_ERROR); |
|
|
|
*num = attr_value.list().type_size(); |
|
|
|
} else if ((!arg_def.type_attr().empty()) || (arg_def.type() != DT_INVALID)) { |
|
|
|
} else if ((!arg_def.type_attr().empty()) || (arg_def.type() != domi::tensorflow::DT_INVALID)) { |
|
|
|
*num = 1; |
|
|
|
} else { |
|
|
|
GELOGE(domi::INTERNAL_ERROR, "In NodeDef %s Attr type_list_attr is not exist.", node_def.name().c_str()); |
|
|
|
@@ -139,7 +139,8 @@ domi::Status NameRangesForNode(const domi::tensorflow::NodeDef &node_def, const |
|
|
|
return NameRangesHelper(node_def, op_def.output_arg(), outputs); |
|
|
|
} |
|
|
|
|
|
|
|
domi::Status RemapFunctionDef(FunctionDef *fdef, const string &name, NameMapHelper &node_names, |
|
|
|
domi::Status RemapFunctionDef(domi::tensorflow::FunctionDef *fdef, const string &name, |
|
|
|
NameMapHelper &node_names, |
|
|
|
std::map<string, string> &tensor_renaming, |
|
|
|
std::map<string, string> &return_values) { |
|
|
|
GE_CHECK_NOTNULL(fdef); |
|
|
|
@@ -156,7 +157,7 @@ domi::Status RemapFunctionDef(FunctionDef *fdef, const string &name, NameMapHelp |
|
|
|
/// Remap input names. We do this as a second pass to allow the nodes to be in |
|
|
|
/// any order. |
|
|
|
for (int n_index = 0; n_index < fdef->node_def_size(); ++n_index) { |
|
|
|
NodeDef *node_def = fdef->mutable_node_def(n_index); |
|
|
|
domi::tensorflow::NodeDef *node_def = fdef->mutable_node_def(n_index); |
|
|
|
for (int i = 0; i < node_def->input_size(); ++i) { |
|
|
|
if (node_def->input(i).find("^") != string::npos) { |
|
|
|
// Control input |
|
|
|
@@ -360,7 +361,7 @@ domi::Status GraphToFunctionDef::RecordArg(ge::ComputeGraphPtr graph, const vect |
|
|
|
|
|
|
|
// Convert Davinci's graph to tensorflow's functiondef |
|
|
|
domi::Status GraphToFunctionDef::DavGraphToFunctionDef(ge::ComputeGraphPtr graph, const string &name, |
|
|
|
FunctionDef *fdef) { |
|
|
|
domi::tensorflow::FunctionDef *fdef) { |
|
|
|
GE_CHECK_NOTNULL(graph); |
|
|
|
GE_CHECK_NOTNULL(fdef); |
|
|
|
fdef->mutable_signature()->set_name(name); |
|
|
|
@@ -433,7 +434,7 @@ domi::Status GraphToFunctionDef::DavGraphToFunctionDef(ge::ComputeGraphPtr graph |
|
|
|
GE_CHK_BOOL_RET_STATUS(op_def.ParseFromString(opdef_string), PARAM_INVALID, "parse op_def failed."); |
|
|
|
|
|
|
|
// add nodedef |
|
|
|
NodeDef *node_def = fdef->add_node_def(); |
|
|
|
domi::tensorflow::NodeDef *node_def = fdef->add_node_def(); |
|
|
|
*node_def = node_def_; |
|
|
|
|
|
|
|
node_def->mutable_attr()->erase(ge::ATTR_NAME_FRAMEWORK_OP_DEF); |
|
|
|
@@ -498,7 +499,7 @@ domi::Status GraphToFunctionDef::DavGraphToFunctionDef(ge::ComputeGraphPtr graph |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
void SetInputOut(NodeDef *call_node_def, vector<ge::InDataAnchorPtr> &in_anchor) { |
|
|
|
void SetInputOut(domi::tensorflow::NodeDef *call_node_def, vector<ge::InDataAnchorPtr> &in_anchor) { |
|
|
|
GE_CHK_BOOL_EXEC(call_node_def != nullptr, return, "call_node_def is null."); |
|
|
|
for (const auto &anchor : in_anchor) { |
|
|
|
if ((anchor != nullptr) && (anchor->GetPeerOutAnchor() != nullptr)) { |
|
|
|
@@ -509,7 +510,8 @@ void SetInputOut(NodeDef *call_node_def, vector<ge::InDataAnchorPtr> &in_anchor) |
|
|
|
} |
|
|
|
|
|
|
|
domi::Status GraphToFunctionDef::BuildFunctionDef(ge::ComputeGraphPtr &graph, const string &name_in, |
|
|
|
FunctionDefLibrary *library, NodeDef *call_node_def, |
|
|
|
domi::tensorflow::FunctionDefLibrary *library, |
|
|
|
domi::tensorflow::NodeDef *call_node_def, |
|
|
|
vector<ge::InDataAnchorPtr> &in_anchor, |
|
|
|
vector<ge::OutDataAnchorPtr> &out_anchor) { |
|
|
|
GE_CHECK_NOTNULL(graph); |
|
|
|
@@ -557,7 +559,7 @@ domi::Status GraphToFunctionDef::BuildFunctionDef(ge::ComputeGraphPtr &graph, co |
|
|
|
GraphToFunctionDef::AddNodeAttr("Tout", tout_value, call_node_def); |
|
|
|
} |
|
|
|
// Convert DaVinci graph to functiondef |
|
|
|
FunctionDef *fdef = library->add_function(); |
|
|
|
domi::tensorflow::FunctionDef *fdef = library->add_function(); |
|
|
|
GE_RETURN_IF_ERROR(GraphToFunctionDef::DavGraphToFunctionDef(graph, name, fdef)); |
|
|
|
|
|
|
|
return SUCCESS; |
|
|
|
|