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

Function preserve_output_layout

src/layout_convolution.cpp:68–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68void preserve_output_layout(module& m)
69{
70 auto last = std::prev(m.end());
71 if(last->name() == "@return")
72 {
73 std::vector<instruction_ref> outputs;
74 std::transform(last->inputs().begin(),
75 last->inputs().end(),
76 std::back_inserter(outputs),
77 [&](instruction_ref ins) {
78 if(skip_layout(ins->get_shape()))
79 return ins;
80 auto permutation = find_permutation(ins->get_shape());
81 return m.insert_instruction(
82 last, make_op("layout", {{"permutation", permutation}}), ins);
83 });
84 m.replace_return(outputs);
85 }
86 else if(not skip_layout(last->get_shape()))
87 {
88 auto permutation = find_permutation(last->get_shape());
89 m.add_instruction(make_op("layout", {{"permutation", permutation}}), last);
90 }
91}
92
93void transform_convolutions(module& m, const layout_convolution& lc)
94{

Callers 1

applyMethod · 0.85

Calls 12

skip_layoutFunction · 0.85
insert_instructionMethod · 0.80
replace_returnMethod · 0.80
find_permutationFunction · 0.70
make_opFunction · 0.70
transformFunction · 0.50
endMethod · 0.45
nameMethod · 0.45
beginMethod · 0.45
inputsMethod · 0.45
get_shapeMethod · 0.45
add_instructionMethod · 0.45

Tested by

no test coverage detected