Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
2ce6ca15
Commit
2ce6ca15
authored
Oct 20, 2022
by
charlie
Browse files
start binary_ops tests
parent
e92fef6e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
src/include/migraphx/op/binary.hpp
src/include/migraphx/op/binary.hpp
+4
-1
test/ref_ops_test.cpp
test/ref_ops_test.cpp
+24
-0
No files found.
src/include/migraphx/op/binary.hpp
View file @
2ce6ca15
...
@@ -61,7 +61,10 @@ struct binary : op_name<Derived>
...
@@ -61,7 +61,10 @@ struct binary : op_name<Derived>
value
attributes
()
const
{
return
base_attributes
();
}
value
attributes
()
const
{
return
base_attributes
();
}
shape
compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
shape
compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
{
{
check_shapes
{
inputs
,
static_cast
<
const
Derived
&>
(
*
this
)}.
has
(
2
).
same_type
().
same_dims
();
check_shapes
{
inputs
,
static_cast
<
const
Derived
&>
(
*
this
),
true
}
.
has
(
2
)
.
same_type
()
.
same_dims
();
auto
s0
=
inputs
.
at
(
0
);
auto
s0
=
inputs
.
at
(
0
);
auto
s1
=
inputs
.
at
(
1
);
auto
s1
=
inputs
.
at
(
1
);
if
(
s0
.
dynamic
()
and
s1
.
dynamic
()
and
s0
==
s1
)
if
(
s0
.
dynamic
()
and
s1
.
dynamic
()
and
s0
==
s1
)
...
...
test/ref_ops_test.cpp
View file @
2ce6ca15
...
@@ -4764,6 +4764,30 @@ TEST_CASE(prelu_test)
...
@@ -4764,6 +4764,30 @@ TEST_CASE(prelu_test)
EXPECT(migraphx::verify_range(results_vector, gold));
EXPECT(migraphx::verify_range(results_vector, gold));
}
}
TEST_CASE(prelu_dynamic_test)
{
migraphx::program p;
auto* mm = p.get_main_module();
std::vector<migraphx::shape::dynamic_dimension> dd{{3, 3, 0}};
migraphx::shape s{migraphx::shape::float_type, dd};
std::vector<float> x_data{-1, 0, 2};
std::vector<float> slope_data{2, 1, 2};
auto x = mm->add_parameter("x", s);
auto slope = mm->add_parameter("slope", s);
mm->add_instruction(migraphx::make_op("prelu"), x, slope);
p.compile(migraphx::ref::target{});
migraphx::parameter_map params0;
migraphx::shape input_fixed_shape0{migraphx::shape::float_type, {3}};
params0["x"] = migraphx::argument(input_fixed_shape0, x_data.data());
params0["slope"] = migraphx::argument(input_fixed_shape0, slope_data.data());
auto result = p.eval(params0).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
std::vector<float> gold = {-2.0f, 0.0f, 2.0f};
EXPECT(migraphx::verify_range(results_vector, gold));
}
TEST_CASE(quant_conv2d_padding_stride_test)
TEST_CASE(quant_conv2d_padding_stride_test)
{
{
migraphx::program p;
migraphx::program p;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment