| 294 | } |
| 295 | |
| 296 | GTransResult ParamRedistributePass::Impl::try_distribute_add(OperatorNodeBase* opr) { |
| 297 | if (opr->same_type<opr::Elemwise>() || opr->input().size() != 2) |
| 298 | return None; |
| 299 | |
| 300 | if (!m_cvprop.is_const(opr->input(1))) |
| 301 | return None; |
| 302 | |
| 303 | auto ab = as_elem_opr(opr->input(0)->owner_opr(), opr::Elemwise::Mode::ADD); |
| 304 | if (ab) { |
| 305 | bool swap; |
| 306 | VarNode *a, *b; |
| 307 | if (reorder_for_normconst(ab, swap, a, b)) { |
| 308 | return BinaryTrans20::distributive_add().apply(opr, false, swap); |
| 309 | } |
| 310 | } |
| 311 | return None; |
| 312 | } |
| 313 | |
| 314 | GTransResult ParamRedistributePass::Impl::try_distribute_then_reassociate( |
| 315 | OperatorNodeBase* opr) { |