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

Function mask_shape

src/reduce_dims.cpp:110–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110static shape mask_shape(const shape& s, const std::vector<std::size_t>& lens)
111{
112 assert(s.lens().size() == lens.size());
113 std::vector<std::size_t> rstrides(lens.size());
114 std::size_t stride = 1;
115 for(std::size_t i = lens.size() - 1; i < lens.size(); i--)
116 {
117 if(lens[i] == s.lens()[i])
118 {
119 rstrides[i] = stride;
120 stride *= lens[i];
121 }
122 else if(lens[i] != 1 and s.lens()[i] != 1)
123 {
124 return shape{};
125 }
126 }
127 return shape{s.type(), lens, rstrides};
128}
129
130std::vector<shape> reduce_dims(const std::vector<shape>& shapes)
131{

Callers 1

reduce_dimsFunction · 0.85

Calls 3

lensMethod · 0.80
sizeMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected