| 270 | } |
| 271 | |
| 272 | SymbolVarArray cg::replace_vars_comp_graph( |
| 273 | const SymbolVarArray& dest, ComputingGraph* new_graph) { |
| 274 | ComputingGraph* orig_graph = dest[0].node()->owner_graph(); |
| 275 | mgb_assert(new_graph != orig_graph); |
| 276 | auto on_opr = [&](OperatorNodeBase* opr, gopt::SubGraph::Rewriter& rewriter) { |
| 277 | OperatorNodeBase* new_opr; |
| 278 | if (opr->input().size()) { |
| 279 | rewriter.auto_replace_outputs(opr); |
| 280 | } else { |
| 281 | mgb_assert(opr->owner_graph() != new_graph); |
| 282 | new_opr = serialization::copy_opr_shallow( |
| 283 | *opr, {}, opr->config(), {new_graph}); |
| 284 | auto &&out0 = opr->output(), &&out1 = new_opr->output(); |
| 285 | mgb_assert(out0.size() == out1.size()); |
| 286 | for (size_t i = 0; i < out0.size(); ++i) { |
| 287 | rewriter.replace_var(out0[i], out1[i], "replace comp graph."); |
| 288 | } |
| 289 | } |
| 290 | }; |
| 291 | return replace_vars_internal(dest, on_opr); |
| 292 | } |
| 293 | |
| 294 | SymbolVarArray cg::find_h2d(const SymbolVarArray& dest) { |
| 295 | mgb_assert(!dest.empty()); |
nothing calls this directly
no test coverage detected