From 91f5b1b68ee86fee57540c6782a246214c8a3d4e Mon Sep 17 00:00:00 2001 From: liubuyu Date: Tue, 2 Feb 2021 18:58:38 +0800 Subject: [PATCH] update io_format to format --- .../ccsrc/backend/optimizer/ascend/ascend_helper.cc | 10 +++++----- mindspore/ccsrc/backend/session/kernel_graph.cc | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/mindspore/ccsrc/backend/optimizer/ascend/ascend_helper.cc b/mindspore/ccsrc/backend/optimizer/ascend/ascend_helper.cc index 84fc8aa6e0..225b6d266d 100644 --- a/mindspore/ccsrc/backend/optimizer/ascend/ascend_helper.cc +++ b/mindspore/ccsrc/backend/optimizer/ascend/ascend_helper.cc @@ -65,8 +65,8 @@ void SetTransNodeAttr(const CNodePtr &trans_node) { std::string InitDefaultFormat(const AnfNodePtr &node) { MS_EXCEPTION_IF_NULL(node); - if (node->isa() && AnfAlgo::HasNodeAttr("io_format", node->cast())) { - auto attr = AnfAlgo::GetNodeAttr(node, "io_format"); + if (node->isa() && AnfAlgo::HasNodeAttr(kAttrFormat, node->cast())) { + auto attr = AnfAlgo::GetNodeAttr(node, kAttrFormat); if (attr == kOpFormat_NCDHW) { return kOpFormat_NCDHW; } @@ -127,11 +127,11 @@ AnfNodePtr InsertTransOpForSingleOutput(const FuncGraphPtr &func_graph, const An std::string output_format = AnfAlgo::GetOutputFormat(node, 0); std::vector origin_shape = AnfAlgo::GetOutputInferShape(node, 0); if (output_format == kOpFormat_NC1KHKWHWC0) { - MS_LOG(EXCEPTION) << "got the hw format " << output_format << "when insert the transdata node " + MS_LOG(EXCEPTION) << "Got the hw format " << output_format << "when insert the transdata node " << node->DebugString() << " trace: " << trace::DumpSourceLines(node); } if (kCommonFormatSet.find(output_format) == kCommonFormatSet.end() && origin_shape.size() > 1) { - MS_LOG(DEBUG) << "Inserted Transdata " << output_format << " To default , index :0"; + MS_LOG(DEBUG) << "Inserted transdata " << output_format << " to default , index :0"; return AddTransOpNodeToGraph(func_graph, node, kernel_select, 0, false); } return node; @@ -364,7 +364,7 @@ CNodePtr InsertCastForInput(const FuncGraphPtr &func_graph, const CNodePtr &cnod const std::string dev_fmt = AnfAlgo::GetInputFormat(cnode, input_index); const std::vector origin_shape = AnfAlgo::GetOutputInferShape(prev_node.first, prev_node.second); // In graph kernel, we check parameter, - // the eliminate pass will not eliminate this case, so we just do not insert the noused cast. + // the eliminate pass will not eliminate this case, so we just do not insert the no used cast. if (func_graph->has_attr(FUNC_GRAPH_ATTR_GRAPH_KERNEL) && IsValueNode(cur_input)) { new_inputs.push_back(cur_input); } else if (TypeId device_type = AnfAlgo::GetInputDeviceDataType(cnode, input_index); origin_type != device_type) { diff --git a/mindspore/ccsrc/backend/session/kernel_graph.cc b/mindspore/ccsrc/backend/session/kernel_graph.cc index f438f5e0ed..71ffbfc6d4 100644 --- a/mindspore/ccsrc/backend/session/kernel_graph.cc +++ b/mindspore/ccsrc/backend/session/kernel_graph.cc @@ -20,6 +20,7 @@ #include #include "base/core_ops.h" #include "ir/param_info.h" +#include "utils/utils.h" #include "backend/session/anf_runtime_algorithm.h" #include "runtime/device/kernel_info.h" #include "backend/kernel_compiler/kernel_build_info.h" @@ -400,8 +401,8 @@ CNodePtr KernelGraph::NewCNode(const std::vector &inputs) { AnfAlgo::SetNodeAttr(kIsBackendCast, MakeValue(false), cnode); } SetKernelInfoForNode(cnode); - if (AnfAlgo::HasNodeAttr("io_format", cnode)) { - auto attr = AnfAlgo::GetNodeAttr(cnode, "io_format"); + if (AnfAlgo::HasNodeAttr(kAttrFormat, cnode)) { + auto attr = AnfAlgo::GetNodeAttr(cnode, kAttrFormat); if (attr == kOpFormat_NCDHW) { ResetInFormat(cnode, kOpFormat_NCDHW); }