test_concat_relu.cpp 1023 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11

#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/operators.hpp>

struct test_concat_relu : verify_program<test_concat_relu>
{
    migraphx::program create_program() const
    {
        migraphx::program p;
12
        auto* mm = p.get_main_module();
13
14
15
16
        int axis = 0;
        migraphx::shape s0{migraphx::shape::float_type, {2, 2}};
        migraphx::shape s1{migraphx::shape::float_type, {3, 2}};
        migraphx::shape s2{migraphx::shape::float_type, {1, 2}};
17
18
19
20
21
22
23
24
        auto l0 = mm->add_parameter("x", s0);
        auto l1 = mm->add_parameter("y", s1);
        auto l2 = mm->add_parameter("z", s2);
        auto r0 = mm->add_instruction(migraphx::op::relu{}, l0);
        auto r1 = mm->add_instruction(migraphx::op::relu{}, l1);
        auto r2 = mm->add_instruction(migraphx::op::relu{}, l2);
        auto c0 = mm->add_instruction(migraphx::op::concat{axis}, r0, r1, r2);
        mm->add_instruction(migraphx::op::relu{}, c0);
25
26
27
        return p;
    }
};