!518 Fix aicpu set attr bug

Merge pull request !518 from zjun/fix_aicpu_attr_bug
This commit is contained in:
mindspore-ci-bot 2020-04-21 23:10:27 +08:00 committed by Gitee
commit 4a0b2b4a0c
1 changed files with 5 additions and 6 deletions

View File

@ -162,18 +162,17 @@ void SetNodeAttr(const std::shared_ptr<AnfNode> &anf_node, mindspore::NodeDef *p
::google::protobuf::Map<::std::string, ::mindspore::AttrValue> *node_attr = proto->mutable_attrs(); ::google::protobuf::Map<::std::string, ::mindspore::AttrValue> *node_attr = proto->mutable_attrs();
for (const auto &attr_ptr : attrs_ptr) { for (const auto &attr_ptr : attrs_ptr) {
std::string attr_name = attr_ptr->name(); std::string attr_name = attr_ptr->name();
std::string real_name;
auto value = primitive->GetAttr(attr_name); auto value = primitive->GetAttr(attr_name);
if (value != nullptr) { if (value != nullptr) {
if (attr_name == kQueueName || attr_name == kSharedName) { if (attr_name == kQueueName || attr_name == kSharedName) {
real_name = kChannelName; attr_name = kChannelName;
} else if (attr_name == kSeed) { } else if (attr_name == kSeed) {
real_name = "seed"; attr_name = "seed";
} else if (attr_name == kSeed2) { } else if (attr_name == kSeed2) {
real_name = "seed2"; attr_name = "seed2";
} }
std::string type = attr_ptr->type(); std::string type = attr_ptr->type();
ParseAttrValue(type, real_name, value, node_attr); ParseAttrValue(type, attr_name, value, node_attr);
} }
} }
MS_LOG(INFO) << "Set node attr end!"; MS_LOG(INFO) << "Set node attr end!";
@ -182,7 +181,7 @@ void SetNodeAttr(const std::shared_ptr<AnfNode> &anf_node, mindspore::NodeDef *p
void SetNodeInputs(const std::shared_ptr<AnfNode> &anf_node, mindspore::NodeDef *proto) { void SetNodeInputs(const std::shared_ptr<AnfNode> &anf_node, mindspore::NodeDef *proto) {
size_t input_num = AnfAlgo::GetInputTensorNum(anf_node); size_t input_num = AnfAlgo::GetInputTensorNum(anf_node);
if (input_num == 0) { if (input_num == 0) {
MS_LOG(INFO) << "Node [" << AnfAlgo::GetCNodeName(anf_node) << "] does not have input. "; MS_LOG(INFO) << "Node [" << AnfAlgo::GetCNodeName(anf_node) << "] does not have input.";
return; return;
} }