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

Function renumber_axes

src/shape_transform_descriptor.cpp:164–183  ·  view source on GitHub ↗

Renumber all axes while preserving the order of the axes

Source from the content-addressed store, hash-verified

162
163// Renumber all axes while preserving the order of the axes
164static void renumber_axes(std::map<std::size_t, std::vector<dimension::sub*>>& axes_map)
165{
166 for(auto&& p : axes_map)
167 {
168 const auto& axis = p.first;
169 auto& subs = p.second;
170 if(subs.size() == 1)
171 {
172 set_origin_axis(*subs[0], {axis});
173 }
174 else
175 {
176 std::sort(subs.begin(), subs.end(), by(std::less<>{}, [](const dimension::sub* s) {
177 return s->origin_axis();
178 }));
179 for(std::size_t i : range(subs.size()))
180 set_origin_axis(*subs[i], {axis, i});
181 }
182 }
183}
184static void renumber_axes(std::vector<dimension>& dimensions)
185{
186 auto axes_map = group_axes(dimensions);

Callers 4

regroup_axesMethod · 0.85
collapse_1_dimsFunction · 0.85
simplifyMethod · 0.85
to_common_from_dstMethod · 0.85

Calls 8

set_origin_axisFunction · 0.85
group_axesFunction · 0.85
sortFunction · 0.50
byFunction · 0.50
rangeFunction · 0.50
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected