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

Method compute_shape

test/run_loop_test.cpp:75–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73 std::string name() const { return "test_loop_op"; }
74
75 migraphx::shape compute_shape(const std::vector<migraphx::shape>& inputs,
76 std::vector<migraphx::module_ref> mods) const
77 {
78 migraphx::check_shapes{inputs, *this}.standard();
79 if(mods.size() != 1)
80 {
81 MIGRAPHX_THROW("LOOP: operator should have one submodule.");
82 }
83
84 const auto& mod = mods.front();
85 auto mod_out_shapes = mod->get_output_shapes();
86 auto dep_param_num = inputs.size() - 2;
87
88 // first item of the mod output shapes is condition used in loop,
89 // which is not needed to compute output shape
90 mod_out_shapes.erase(mod_out_shapes.begin());
91 std::vector<migraphx::shape> ins_out_shapes(mod_out_shapes.begin(),
92 mod_out_shapes.begin() + dep_param_num);
93 mod_out_shapes.erase(mod_out_shapes.begin(), mod_out_shapes.begin() + dep_param_num);
94 for(const auto& out_s : mod_out_shapes)
95 {
96 auto lens = out_s.lens();
97 lens.insert(lens.begin(), max_iterations);
98 ins_out_shapes.push_back({out_s.type(), lens});
99 }
100
101 return migraphx::shape(ins_out_shapes);
102 }
103
104 struct test_loop : public migraphx::op::loop::ref_loop
105 {

Callers

nothing calls this directly

Calls 11

frontMethod · 0.80
eraseMethod · 0.80
lensMethod · 0.80
shapeFunction · 0.50
standardMethod · 0.45
sizeMethod · 0.45
get_output_shapesMethod · 0.45
beginMethod · 0.45
insertMethod · 0.45
push_backMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected