MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / NeedBoxing

Method NeedBoxing

oneflow/core/graph/op_graph.cpp:28–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26namespace oneflow {
27
28bool 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
51std::string OpEdge::VisualStr() const {
52 std::string str;

Callers 2

InitMethod · 0.80
ConnectDataEdgesMethod · 0.80

Calls 6

InOutParallelDimReduceFunction · 0.85
parallel_desc_symMethod · 0.80
hierarchyMethod · 0.80
parallel_numMethod · 0.45
parallel_descMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected