Commit b5a02fea authored by Brian Pickrell's avatar Brian Pickrell
Browse files

sample of onnx test, not implemented

parent 4166593f
......@@ -44,6 +44,7 @@ def onnx_test(op_test):
op_info[1], op_info[2])
model_def = helper.make_model(graph_def,
producer_name=op_test.__name__)
print('hello', op_test.__name__)
onnx.save(model_def, '{}.onnx'.format(op_test.__name__))
return run_test
......@@ -4451,6 +4452,18 @@ def reducel1_test():
return ([node], [x], [y])
def reducel1_dyn_test():
x = helper.make_tensor_value_info('x', TensorProto.FLOAT, [None])
y = helper.make_tensor_value_info('y', TensorProto.FLOAT, [None])
axes = [-2]
node = onnx.helper.make_node('ReduceL1_dyn',
inputs=['x'],
outputs=['y'],
axes=axes,
keepdims=0)
return ([node], [x], [y])
@onnx_test
def reducel2_test():
......
......@@ -4241,6 +4241,22 @@ TEST_CASE(reducel1_test)
EXPECT(p == prog);
}
TEST_CASE(reducel1_dyn_test)
{
migraphx::program p;
auto* mm = p.get_main_module();
// a shape with 4 dynamic dimensions
auto l0 = mm->add_parameter(
"x",
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 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 prog = optimize_onnx("reducel1_dyn_test.onnx");
EXPECT(p == prog);
}
TEST_CASE(reducel2_test)
{
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