"test/srt/test_torch_compile_moe.py" did not exist on "86fc0d79d0b564fba1c313feafd15323ba731418"
test_mul_add.cpp 981 Bytes
Newer Older
1
2
3
4

#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
5
#include <migraphx/make_op.hpp>
6
7
8
9
10
11

struct test_mul_add : verify_program<test_mul_add>
{
    migraphx::program create_program() const
    {
        migraphx::program p;
12
        auto* mm = p.get_main_module();
13
14
        migraphx::shape s{migraphx::shape::float_type, {2, 3}};
        migraphx::shape bs{migraphx::shape::float_type, {3}};
15
16
17
18
        auto x  = mm->add_parameter("x", s);
        auto a  = mm->add_parameter("a", bs);
        auto b  = mm->add_parameter("b", bs);
        auto ab = mm->add_instruction(
19
            migraphx::make_op("broadcast", {{"axis", 1}, {"out_lens", s.lens()}}), a);
20
        auto bb = mm->add_instruction(
21
            migraphx::make_op("broadcast", {{"axis", 1}, {"out_lens", s.lens()}}), b);
22
23
        auto mul = mm->add_instruction(migraphx::make_op("mul"), x, ab);
        mm->add_instruction(migraphx::make_op("add"), mul, bb);
24
25
26
        return p;
    }
};