Commit 8ded3a31 authored by Khalique's avatar Khalique
Browse files

manual merge, add test

parents b05e573d 3da18f30
......@@ -313,7 +313,11 @@ struct onnx_parser
{
if(contains(attributes, "auto_pad"))
{
MIGRAPHX_THROW("auto_pad and padding cannot be specified simultaneously");
auto s = attributes["auto_pad"].s();
if(contains(attributes, "pads") and to_upper(s) != "NOTSET")
{
MIGRAPHX_THROW("auto_pad and padding cannot be specified simultaneously");
}
}
std::vector<std::int64_t> padding;
copy(attributes["pads"].ints(), std::back_inserter(padding));
......
......@@ -502,6 +502,31 @@ def const_of_shape_no_value_attr_test():
model_def = helper.make_model(graph_def, producer_name='constant-of-shape')
onnx.save(model_def, 'const_of_shape_no_value_attr_test.onnx')
def conv_autopad_fail_test():
x = helper.make_tensor_value_info('0', TensorProto.FLOAT, [1, 3, 32, 32])
y = helper.make_tensor_value_info('1', TensorProto.FLOAT, [1, 3, 1, 1])
out = helper.make_tensor_value_info('2', TensorProto.FLOAT, [1, 1, 34, 34])
node = onnx.helper.make_node(
'Conv',
inputs=['0', '1'],
outputs=['2'],
dilations = [1, 1],
strides = [1, 1],
auto_pad = 'SAME',
pads = [0,0,1,1,0,0,1,1]
)
graph_def = helper.make_graph(
[node],
'test_conv',
[x, y],
[out],
)
model_def = helper.make_model(graph_def, producer_name='conv-example')
onnx.save(model_def, 'conv_autopad_fail_test.onnx')
def conv_bias_test():
x = helper.make_tensor_value_info('0', TensorProto.FLOAT, [1, 3, 32, 32])
y = helper.make_tensor_value_info('1', TensorProto.FLOAT, [1, 3, 5, 5])
......
......@@ -228,6 +228,11 @@ TEST_CASE(const_of_shape_no_value_attr_test)
EXPECT(p == prog);
}
TEST_CASE(conv_autopad_fail_test)
{
EXPECT(test::throws([&] { migraphx::parse_onnx("conv_autopad_fail_test.onnx"); }));
}
TEST_CASE(conv_bias_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