!49858 export primitive instance name

Merge pull request !49858 from lianliguang/r2.0.0-beta
This commit is contained in:
i-robot 2023-03-08 04:52:04 +00:00 committed by Gitee
commit 116e412c77
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 7 additions and 4 deletions

View File

@ -246,6 +246,8 @@ bool IrExportBuilder::BuildPrimitives() {
prim = real_prim;
}
prim_proto->set_instance_name(prim->instance_name());
// Set primitive attributes
for (const auto &attr : prim->attrs()) {
MS_LOG(DEBUG) << "attr: " << attr.first << " " << attr.second->DumpText() << " " << attr.second->type_name();

View File

@ -2009,16 +2009,16 @@ bool MSANFModelParser::BuildPrimitiveNode(const mind_ir::PrimitiveProto &primiti
if (prim_type.compare(0, strlen(kDoSignaturePrimitivePrefix), kDoSignaturePrimitivePrefix) == 0) {
auto op_name = prim_type.substr(strlen(kDoSignaturePrimitivePrefix));
prim = std::make_shared<prim::DoSignaturePrimitive>(op_name, std::make_shared<Primitive>(op_name));
MS_EXCEPTION_IF_NULL(prim);
prim->set_instance_name(op_name);
} else {
MS_LOG(DEBUG) << "Special node_type: " << prim_type;
prim = std::make_shared<Primitive>(prim_type);
MS_EXCEPTION_IF_NULL(prim);
prim->set_instance_name(prim_type);
}
}
if (primitive_proto.has_instance_name()) {
prim->set_instance_name(primitive_proto.instance_name());
}
// Set primitive attributes
auto prim_to_add_attr = GetValueWithoutDoSignature(prim)->cast<PrimitivePtr>();
MS_EXCEPTION_IF_NULL(prim_to_add_attr);

View File

@ -222,4 +222,5 @@ message PrimitiveProto {
optional string name = 1;
optional string op_type = 2;
repeated AttributeProto attribute = 3;
optional string instance_name = 4;
}