Commit 40a271b3 authored by Khalique's avatar Khalique
Browse files

formatting

parent b3de1cfa
......@@ -28,7 +28,10 @@ void pad_rewrite::apply(program& p) const
}
template <class T>
void pad_rewrite::update_op(T, const instruction_ref& input, const instruction_ref& ins, program& p) const
void pad_rewrite::update_op(T,
const instruction_ref& input,
const instruction_ref& ins,
program& p) const
{
auto pad_op = any_cast<op::pad>(input->get_operator());
if(!pad_op.symmetric())
......
......@@ -15,7 +15,8 @@ struct pad_rewrite_target
migraphx::context get_context() const { return {}; }
};
migraphx::instruction_ref create_im2col(migraphx::instruction_ref& l_img, size_t channels, migraphx::program& p)
migraphx::instruction_ref
create_im2col(migraphx::instruction_ref& l_img, size_t channels, migraphx::program& p)
{
size_t f[2] = {1, 1};
std::vector<int32_t> weights(channels * f[0] * f[1]);
......@@ -25,7 +26,8 @@ migraphx::instruction_ref create_im2col(migraphx::instruction_ref& l_img, size_t
return p.add_instruction(migraphx::op::im2col{}, l_img, l_weights);
}
migraphx::instruction_ref create_conv(migraphx::instruction_ref& l_img, size_t channels, migraphx::program& p)
migraphx::instruction_ref
create_conv(migraphx::instruction_ref& l_img, size_t channels, migraphx::program& p)
{
migraphx::shape s_weights{migraphx::shape::int32_type, {4, channels, 3, 3}};
std::vector<int32_t> weights(4 * channels * 3 * 3);
......@@ -45,7 +47,7 @@ TEST_CASE(rewrite_test)
migraphx::shape s_img{migraphx::shape::int32_type, {1, channels, img_dim[0], img_dim[1]}};
auto l_img = p.add_literal(migraphx::literal{s_img, input});
auto padded_img = p.add_instruction(migraphx::op::pad{{0,0,1,1,0,0,1,1}}, l_img);
auto padded_img = p.add_instruction(migraphx::op::pad{{0, 0, 1, 1, 0, 0, 1, 1}}, l_img);
auto l0 = create_im2col(padded_img, channels, p);
auto l1 = create_conv(padded_img, channels, p);
......@@ -53,9 +55,8 @@ TEST_CASE(rewrite_test)
p.add_instruction(migraphx::op::identity{}, l0, l1, l2);
p.compile(pad_rewrite_target{});
EXPECT(std::none_of(p.begin(), p.end(), [](const migraphx::instruction& ins) {
return ins.name() == "pad";
}));
EXPECT(std::none_of(
p.begin(), p.end(), [](const migraphx::instruction& ins) { return ins.name() == "pad"; }));
}
TEST_CASE(rewrite_test_asymmetric)
......@@ -68,14 +69,13 @@ TEST_CASE(rewrite_test_asymmetric)
migraphx::shape s_img{migraphx::shape::int32_type, {1, channels, img_dim[0], img_dim[1]}};
auto l_img = p.add_literal(migraphx::literal{s_img, input});
auto padded_img = p.add_instruction(migraphx::op::pad{{0,0,0,0,0,0,2,2}}, l_img);
auto padded_img = p.add_instruction(migraphx::op::pad{{0, 0, 0, 0, 0, 0, 2, 2}}, l_img);
create_im2col(padded_img, channels, p);
p.compile(pad_rewrite_target{});
EXPECT(std::any_of(p.begin(), p.end(), [](const migraphx::instruction& ins) {
return ins.name() == "pad";
}));
EXPECT(std::any_of(
p.begin(), p.end(), [](const migraphx::instruction& ins) { return ins.name() == "pad"; }));
}
int main(int argc, const char* argv[]) { test::run(argc, argv); }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment