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

Function find_broadcasted_dims

src/shape_transform_descriptor.cpp:1273–1292  ·  view source on GitHub ↗

Find broadcasted dimensions. This will store a map from the next axis to the indices of the previous dimensions that are being broadcasted.

Source from the content-addressed store, hash-verified

1271// Find broadcasted dimensions. This will store a map from the next axis
1272// to the indices of the previous dimensions that are being broadcasted.
1273static std::map<std::size_t, std::deque<std::size_t>>
1274find_broadcasted_dims(const std::vector<dimension>& dimensions, std::size_t rank)
1275{
1276 std::map<std::size_t, std::deque<std::size_t>> broadcast_dims_map;
1277 group_find(
1278 dimensions.begin(), dimensions.end(), &missing_leading_axis, [&](auto start, auto last) {
1279 auto axis = rank;
1280 if(last != dimensions.end())
1281 {
1282 assert(not last->subdimensions.empty());
1283 const auto& sub = last->subdimensions.front();
1284 assert(not sub.origin_axis().empty());
1285 axis = sub.origin_axis().front();
1286 }
1287 std::deque<std::size_t> dims(std::distance(start, last));
1288 std::iota(dims.begin(), dims.end(), std::distance(dimensions.begin(), start));
1289 broadcast_dims_map[axis] = dims;
1290 });
1291 return broadcast_dims_map;
1292}
1293
1294void shape_transform_descriptor::simplify()
1295{

Callers 1

simplifyMethod · 0.85

Calls 7

group_findFunction · 0.85
distanceFunction · 0.85
iotaFunction · 0.85
frontMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected