Commit 5f7f4ebc authored by Shucai Xiao's avatar Shucai Xiao
Browse files

add onnx unit tests

parent 814793ec
...@@ -3285,6 +3285,25 @@ def resize_upsample_pc_test(): ...@@ -3285,6 +3285,25 @@ def resize_upsample_pc_test():
return ([node], [X], [Y], [scale_tensor]) return ([node], [X], [Y], [scale_tensor])
@onnx_test
def scatter_test():
x = helper.make_tensor_value_info('data', TensorProto.FLOAT, [3, 4, 5, 6])
i = helper.make_tensor_value_info('indices', TensorProto.INT32,
[2, 3, 4, 5])
u = helper.make_tensor_value_info('update', TensorProto.FLOAT,
[2, 3, 4, 5])
y = helper.make_tensor_value_info('y', TensorProto.FLOAT, [3, 4, 5, 6])
node = onnx.helper.make_node(
'Scatter',
inputs=['data', 'indices', 'update'],
outputs=['y'],
axis=-2,
)
return ([node], [x, i, u], [y])
@onnx_test @onnx_test
def selu_test(): def selu_test():
x = helper.make_tensor_value_info('x', TensorProto.DOUBLE, [2, 3]) x = helper.make_tensor_value_info('x', TensorProto.DOUBLE, [2, 3])
......
...@@ -3102,6 +3102,21 @@ TEST_CASE(round_test) ...@@ -3102,6 +3102,21 @@ TEST_CASE(round_test)
EXPECT(p == prog); EXPECT(p == prog);
} }
TEST_CASE(scatter_test)
{
migraphx::program p;
auto* mm = p.get_main_module();
auto l0 = mm->add_parameter("data", migraphx::shape{migraphx::shape::float_type, {3, 4, 5, 6}});
auto l1 = mm->add_parameter("indices", migraphx::shape{migraphx::shape::int32_type, {2, 3, 4, 5}});
auto l2 = mm->add_parameter("update", migraphx::shape{migraphx::shape::float_type, {2, 3, 4, 5}});
int axis = -2;
auto r = mm->add_instruction(migraphx::make_op("scatter", {{"axis", axis}}), l0, l1, l2);
mm->add_return({r});
auto prog = migraphx::parse_onnx("scatter_test.onnx");
EXPECT(p == prog);
}
TEST_CASE(selu_test) TEST_CASE(selu_test)
{ {
migraphx::program p; migraphx::program p;
......
 scatter_test:
9
data
indices
updatey"Scatter*
axis scatter_testZ
data




Z!
indices




Z
update




b
y




B
\ No newline at end of file
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