| 26 | namespace oneflow { |
| 27 | |
| 28 | bool OpEdge::NeedBoxing() const { |
| 29 | if (src_node()->parallel_desc_sym() != dst_node()->parallel_desc_sym()) { return true; } |
| 30 | if (src_node()->parallel_desc().parallel_num() == 1) { return false; } |
| 31 | for (const auto& lbi : *lbis_) { |
| 32 | Shape src_reduced_hierarchy; |
| 33 | Shape dst_reduced_hierarchy; |
| 34 | NdSbp src_reduced_nd_sbp; |
| 35 | NdSbp dst_reduced_nd_sbp; |
| 36 | |
| 37 | InOutParallelDimReduce(*src_node()->parallel_desc().hierarchy(), |
| 38 | *dst_node()->parallel_desc().hierarchy(), src_node()->NdSbp4Lbi(lbi), |
| 39 | dst_node()->NdSbp4Lbi(lbi), &src_reduced_hierarchy, |
| 40 | &dst_reduced_hierarchy, &src_reduced_nd_sbp, &dst_reduced_nd_sbp, |
| 41 | src_node()->LogicalBlobDesc4Lbi(lbi).shape()); |
| 42 | if (src_reduced_hierarchy != dst_reduced_hierarchy |
| 43 | || src_reduced_nd_sbp != dst_reduced_nd_sbp) { |
| 44 | // Not one to one |
| 45 | return true; |
| 46 | } |
| 47 | } |
| 48 | return false; |
| 49 | } |
| 50 | |
| 51 | std::string OpEdge::VisualStr() const { |
| 52 | std::string str; |
no test coverage detected