forked from mindspore-Ecosystem/mindspore
!49858 export primitive instance name
Merge pull request !49858 from lianliguang/r2.0.0-beta
This commit is contained in:
commit
116e412c77
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -222,4 +222,5 @@ message PrimitiveProto {
|
|||
optional string name = 1;
|
||||
optional string op_type = 2;
|
||||
repeated AttributeProto attribute = 3;
|
||||
optional string instance_name = 4;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue