MCPcopy Create free account
hub / github.com/alibaba/euler / AddPostProcessNode

Method AddPostProcessNode

euler/parser/translator.cc:179–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179std::shared_ptr<NodeDef> Translator::AddPostProcessNode(
180 const NodeDef& node_def, DAGDef* dag_def) {
181 for (std::shared_ptr<AttrDef> attr : node_def.attrs_) {
182 if (attr->attr_type_ == AttrDef::kCond) {
183 std::shared_ptr<CondAttrDef> cond =
184 std::static_pointer_cast<CondAttrDef>(attr);
185 if (!cond->post_process_.empty()) {
186 std::shared_ptr<NodeDef> pp_node =
187 dag_def->ProduceNodeDef("POST_PROCESS", node_def.output_num_);
188 pp_node->op_alias_ = node_def.name_;
189 std::shared_ptr<CondAttrDef> cond_attr_def =
190 std::make_shared<CondAttrDef>();
191 for (const std::string& pp : cond->post_process_) {
192 std::vector<std::string> vec = Split(pp, " ");
193 if (vec[0] == "order_by" && vec[1] == "weight" &&
194 node_def.name_ != "API_GET_NODE_WITH_WEIGHT" &&
195 node_def.name_ != "API_GET_EDGE_WITH_WEIGHT") {
196 EULER_LOG(FATAL) << "order by weight need weight output";
197 }
198 cond_attr_def->post_process_.push_back(pp);
199 }
200 for (int32_t i = 0; i < node_def.output_num_; ++i) {
201 pp_node->input_edges_.push_back({node_def.name_, node_def.id_, i});
202 }
203 pp_node->attrs_.push_back(cond_attr_def);
204 std::unordered_set<int32_t> pp_node_pre, succ;
205 pp_node_pre.insert(node_def.id_);
206 dag_def->AddNodeDef(pp_node, pp_node_pre, succ);
207 return pp_node; // assume only one cond attr
208 }
209 }
210 }
211 return nullptr;
212}
213
214int32_t Translator::SingleNodeBuilder(
215 const TreeNode& tree_node, int32_t default_pre_node_id, DAGDef* dag_def,

Callers

nothing calls this directly

Calls 4

SplitFunction · 0.85
ProduceNodeDefMethod · 0.80
AddNodeDefMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected