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

Method get_dimensions_for

src/common_dims.cpp:225–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225std::vector<std::size_t>
226common_dims::get_dimensions_for(const std::vector<std::size_t>& idims) const
227{
228 if(dims.size() == idims.size())
229 return idims;
230 if(elements(dims) == elements(idims))
231 return dims;
232 // Bail for now since its ambiguous which axes map can be used
233 // TODO: Check for similiarity
234 if(axes_map1.size() == axes_map2.size())
235 return {};
236 const auto* axes_map = get_axes_map(idims.size());
237 if(axes_map == nullptr)
238 return {};
239 auto xdims = dims;
240 for(auto i : range(axes_map->size()))
241 {
242 auto dim = idims[i];
243 const auto& axes = (*axes_map)[i];
244 if(axes.size() == 1)
245 {
246 xdims[axes.front()] = dim;
247 }
248 else if(dim == 1)
249 {
250 for(auto axis : axes)
251 xdims[axis] = 1;
252 }
253 }
254 if(elements(xdims) == elements(idims))
255 return xdims;
256 return {};
257}
258
259} // namespace MIGRAPHX_INLINE_NS
260} // namespace migraphx

Callers 2

verify_commonFunction · 0.80
TEST_CASEFunction · 0.80

Calls 4

frontMethod · 0.80
elementsFunction · 0.50
rangeFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected