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

Function transform_convolutions

src/layout_convolution.cpp:93–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93void transform_convolutions(module& m, const layout_convolution& lc)
94{
95 for(auto ins : iterator_for(m))
96 {
97 if(not contains({"convolution", "quant_convolution"}, ins->name()))
98 continue;
99 if(ins->get_shape().dynamic())
100 continue;
101 if(ins->get_shape().lens().size() != 4)
102 continue;
103 auto v = ins->get_operator().to_value();
104 bool is_group_conv = v.at("group").to<int>() > 1;
105 auto args = ins->inputs();
106 auto perm = is_group_conv ? get_default_permutation(ins) : get_permutation(ins, lc);
107 std::transform(args.begin(), args.end(), args.begin(), [&](const auto& i) {
108 return m.insert_instruction(ins, make_op("layout", {{"permutation", perm}}), i);
109 });
110 auto conv = m.insert_instruction(ins, ins->get_operator(), args);
111 auto c = m.insert_instruction(ins, make_op("contiguous"), conv);
112 m.replace_instruction(ins, c);
113 }
114}
115
116void remove_layout(module& m)
117{

Callers 1

applyMethod · 0.85

Calls 15

iterator_forFunction · 0.85
containsFunction · 0.85
get_default_permutationFunction · 0.85
get_permutationFunction · 0.85
dynamicMethod · 0.80
lensMethod · 0.80
atMethod · 0.80
insert_instructionMethod · 0.80
replace_instructionMethod · 0.80
make_opFunction · 0.70
transformFunction · 0.50
nameMethod · 0.45

Tested by

no test coverage detected