Commit 99ff9af8 authored by Brian Pickrell's avatar Brian Pickrell
Browse files

Fixed onnx test to use dynamic squeeze op and added a second onnx test for reduce ops.

parent 13ea6f19
...@@ -4569,6 +4569,22 @@ def reduce_log_sum_exp_test(): ...@@ -4569,6 +4569,22 @@ def reduce_log_sum_exp_test():
def reducemax_test(): def reducemax_test():
x = helper.make_tensor_value_info('x', TensorProto.FLOAT, [3, 4, 5, 6]) x = helper.make_tensor_value_info('x', TensorProto.FLOAT, [3, 4, 5, 6])
y = helper.make_tensor_value_info('y', TensorProto.FLOAT, [3, 4, 6]) y = helper.make_tensor_value_info('y', TensorProto.FLOAT, [3, 4, 6])
axes = [2]
node = onnx.helper.make_node('ReduceMax',
inputs=['x'],
outputs=['y'],
axes=axes,
keepdims=0)
return ([node], [x], [y])
@onnx_test
def reducemax_dyn_test():
x = helper.make_tensor_value_info('x', TensorProto.FLOAT, [None, 4, 5, 6])
y = helper.make_tensor_value_info('y', TensorProto.FLOAT, [3, 4, 6])
axes = [2] axes = [2]
node = onnx.helper.make_node('ReduceMax', node = onnx.helper.make_node('ReduceMax',
......
...@@ -4321,8 +4321,12 @@ TEST_CASE(reducel1_dyn_test) ...@@ -4321,8 +4321,12 @@ TEST_CASE(reducel1_dyn_test)
migraphx::shape{migraphx::shape::float_type, {{3, 3, 0}, {3, 5, 0}, {4, 6, 5}, {5, 7, 6}}}); migraphx::shape{migraphx::shape::float_type, {{3, 3, 0}, {3, 5, 0}, {4, 6, 5}, {5, 7, 6}}});
auto abs_l0 = mm->add_instruction(migraphx::make_op("abs"), l0); auto abs_l0 = mm->add_instruction(migraphx::make_op("abs"), l0);
auto sum_l0 = mm->add_instruction(migraphx::make_op("reduce_sum", {{"axes", {-2}}}), abs_l0); auto sum_l0 = mm->add_instruction(migraphx::make_op("reduce_sum", {{"axes", {-2}}}), abs_l0);
mm->add_instruction(migraphx::make_op("squeeze", {{"axes", {-2}}}), sum_l0); auto sq_l0 = mm->add_instruction(migraphx::make_op("squeeze", {{"axes", {-2}}}), sum_l0);
auto prog = optimize_onnx("reducel1_dyn_test.onnx"); mm->add_return({sq_l0});
migraphx::onnx_options options;
options.map_dyn_input_dims["x"] = {{3, 3}, {3, 5}, {4, 6, 5}, {5, 7, 6}};
auto prog = migraphx::parse_onnx("reducel1_dyn_test.onnx", options);
EXPECT(p == prog); EXPECT(p == prog);
} }
...@@ -4377,6 +4381,24 @@ TEST_CASE(reducemax_test) ...@@ -4377,6 +4381,24 @@ TEST_CASE(reducemax_test)
EXPECT(p == prog); EXPECT(p == prog);
} }
TEST_CASE(reducemax_dyn_test)
{
// input shape with 4 dynamic dimensions
migraphx::program p;
auto* mm = p.get_main_module();
auto l0 = mm->add_parameter(
"x", migraphx::shape{migraphx::shape::float_type, {{3, 3}, {4, 4}, {5, 5}, {6, 6}}});
auto r0 = mm->add_instruction(migraphx::make_op("reduce_max", {{"axes", {2}}}), l0);
auto r1 = mm->add_instruction(migraphx::make_op("squeeze", {{"axes", {2}}}), r0);
mm->add_return({r1});
migraphx::onnx_options options;
options.map_dyn_input_dims["x"] = {{3, 3}, {4, 4}, {5, 5}, {6, 6}};
auto prog = migraphx::parse_onnx("reducemax_dyn_test.onnx", options);
EXPECT(p == prog);
}
TEST_CASE(reducemean_test) TEST_CASE(reducemean_test)
{ {
migraphx::program p; migraphx::program p;
......
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