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

Function insert_empty_1s

src/shape_transform_descriptor.cpp:1233–1252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1231}
1232
1233static void insert_empty_1s(std::vector<dimension>& dimensions, std::size_t rank)
1234{
1235 if(dimensions.empty())
1236 return;
1237 transform(dimensions,
1238 range(rank),
1239 dimensions.begin(),
1240 [](const dimension& d, std::size_t i) -> dimension {
1241 auto result = dimension::sub{d.len(), {i}};
1242 if(result.len > 1)
1243 result.hide();
1244 return {{result}};
1245 });
1246 if(rank > dimensions.size())
1247 {
1248 transform(range(dimensions.size(), rank),
1249 std::back_inserter(dimensions.back().subdimensions),
1250 [](std::size_t i) { return dimension::sub{1, {i}}; });
1251 }
1252}
1253
1254// Find missing axes. This will store a mapping between the missing
1255// axis and the next available axis.

Callers 1

simplifyMethod · 0.85

Calls 8

lenMethod · 0.80
hideMethod · 0.80
backMethod · 0.80
transformFunction · 0.50
rangeFunction · 0.50
emptyMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected