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

Function attach_empty_axis

src/shape_transform_descriptor.cpp:1573–1589  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1571}
1572
1573static std::vector<dimension::sub> attach_empty_axis(std::vector<dimension::sub> tsubs)
1574{
1575 // Inject additonal axis to compute transpose permutation better
1576 auto is_empty_axis = [](const auto& s) { return s.axis.empty(); };
1577 group_find(tsubs.begin(), tsubs.end(), is_empty_axis, [&](auto start, auto last) {
1578 if(start == tsubs.begin())
1579 return;
1580 auto base = std::prev(start);
1581 auto axis = base->axis;
1582 axis.push_back(0);
1583 std::for_each(start, last, [&](auto& s) {
1584 s.axis = axis;
1585 axis.back()++;
1586 });
1587 });
1588 return tsubs;
1589}
1590
1591static std::vector<int64_t> find_permutation(const std::vector<dimension::sub>& subs)
1592{

Callers 1

generateMethod · 0.85

Calls 7

group_findFunction · 0.85
backMethod · 0.80
for_eachFunction · 0.50
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected