add op names mapping for one hwopt pass

This commit is contained in:
huanghui 2020-06-11 10:35:46 +08:00
parent cc0add562b
commit 1044310783
2 changed files with 6 additions and 0 deletions

View File

@ -18,6 +18,7 @@
#include <memory>
#include <vector>
#include <tuple>
#include <string>
#include "session/anf_runtime_algorithm.h"
#include "common/utils.h"
@ -50,6 +51,8 @@ CNodePtr GenerateSquareSumV1(const FuncGraphPtr &graph, const CNodePtr &square,
square_sumv1->set_scope(sum->scope());
AnfAlgo::CopyNodeAttr(kAttrAxis, sum, square_sumv1);
AnfAlgo::CopyNodeAttr(kAttrKeepDims, sum, square_sumv1);
auto names = MakeValue<std::vector<std::string>>({prim::kPrimSquare->name(), prim::kPrimReduceSum->name()});
AnfAlgo::SetNodeAttr(kAttrDatadumpOriginalNames, names, square_sumv1);
return square_sumv1;
}
@ -71,6 +74,8 @@ CNodePtr GenerateSquareSumV2(const FuncGraphPtr &graph, const CNodePtr &square,
square_sumv2->set_scope(sum->scope());
AnfAlgo::CopyNodeAttr(kAttrAxis, sum, square_sumv2);
AnfAlgo::CopyNodeAttr(kAttrKeepDims, sum, square_sumv2);
auto names = MakeValue<std::vector<std::string>>({prim::kPrimSquare->name(), prim::kPrimReduceSum->name()});
AnfAlgo::SetNodeAttr(kAttrDatadumpOriginalNames, names, square_sumv2);
return square_sumv2;
}

View File

@ -200,6 +200,7 @@ constexpr auto kAttrLabelIndex = "label_index";
constexpr auto kAttrLabelSwitchList = "label_switch_list";
constexpr auto kAttrNewAxisMask = "new_axis_mask";
constexpr auto kAttrShrinkAxisMask = "shrink_axis_mask";
constexpr auto kAttrDatadumpOriginalNames = "_datadump_original_names";
// attr value
constexpr auto kValueTargetSwitch = "target_switch";