MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / remove_split_hidden_axes

Function remove_split_hidden_axes

src/shape_transform_descriptor.cpp:1097–1122  ·  view source on GitHub ↗

If an axis is split and some dimensions are hidden and others are not, then remove the hidden axis so only the non-hidden axis is used in simplificaiton

Source from the content-addressed store, hash-verified

1095// remove the hidden axis so only the non-hidden axis is used in
1096// simplificaiton
1097static void remove_split_hidden_axes(std::map<std::size_t, std::vector<dimension::sub*>>& axes_map)
1098{
1099 for(auto&& p : axes_map)
1100 {
1101 auto& subs = p.second;
1102 if(std::all_of(subs.begin(), subs.end(), [](const dimension::sub* s) {
1103 return s->has_hidden_axis();
1104 }))
1105 continue;
1106 for(auto* sub : subs)
1107 {
1108 if(not sub->has_hidden_axis())
1109 continue;
1110 sub->hidden_axis.clear();
1111 }
1112 // Remove the subdimesions that no longer have an axis
1113 subs.erase(std::remove_if(subs.begin(),
1114 subs.end(),
1115 [](const dimension::sub* s) {
1116 return s->axis.empty() and s->hidden_axis.empty();
1117 }),
1118 subs.end());
1119 }
1120 // Remove axis from group if empty
1121 erase_if(axes_map, [](auto&& p) { return p.second.empty(); });
1122}
1123
1124// Replace the hidden axis that is split with an axis that is missing
1125static void fill_split_hidden_axes(std::map<std::size_t, std::vector<dimension::sub*>>& axes_map,

Callers 1

simplifyMethod · 0.85

Calls 8

erase_ifFunction · 0.85
eraseMethod · 0.80
all_ofFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
has_hidden_axisMethod · 0.45
clearMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected