forked from mindspore-Ecosystem/mindspore
export primitive instance name for node
This commit is contained in:
parent
aa905d51af
commit
d3a0058b3c
|
@ -246,6 +246,8 @@ bool IrExportBuilder::BuildPrimitives() {
|
||||||
prim = real_prim;
|
prim = real_prim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prim_proto->set_instance_name(prim->instance_name());
|
||||||
|
|
||||||
// Set primitive attributes
|
// Set primitive attributes
|
||||||
for (const auto &attr : prim->attrs()) {
|
for (const auto &attr : prim->attrs()) {
|
||||||
MS_LOG(DEBUG) << "attr: " << attr.first << " " << attr.second->DumpText() << " " << attr.second->type_name();
|
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) {
|
if (prim_type.compare(0, strlen(kDoSignaturePrimitivePrefix), kDoSignaturePrimitivePrefix) == 0) {
|
||||||
auto op_name = prim_type.substr(strlen(kDoSignaturePrimitivePrefix));
|
auto op_name = prim_type.substr(strlen(kDoSignaturePrimitivePrefix));
|
||||||
prim = std::make_shared<prim::DoSignaturePrimitive>(op_name, std::make_shared<Primitive>(op_name));
|
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 {
|
} else {
|
||||||
MS_LOG(DEBUG) << "Special node_type: " << prim_type;
|
MS_LOG(DEBUG) << "Special node_type: " << prim_type;
|
||||||
prim = std::make_shared<Primitive>(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
|
// Set primitive attributes
|
||||||
auto prim_to_add_attr = GetValueWithoutDoSignature(prim)->cast<PrimitivePtr>();
|
auto prim_to_add_attr = GetValueWithoutDoSignature(prim)->cast<PrimitivePtr>();
|
||||||
MS_EXCEPTION_IF_NULL(prim_to_add_attr);
|
MS_EXCEPTION_IF_NULL(prim_to_add_attr);
|
||||||
|
|
|
@ -222,4 +222,5 @@ message PrimitiveProto {
|
||||||
optional string name = 1;
|
optional string name = 1;
|
||||||
optional string op_type = 2;
|
optional string op_type = 2;
|
||||||
repeated AttributeProto attribute = 3;
|
repeated AttributeProto attribute = 3;
|
||||||
|
optional string instance_name = 4;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue