From 60bb9d80fa6fedfcb51afc0c9a74d6c2948873fd Mon Sep 17 00:00:00 2001 From: Sadik Armagan Date: Mon, 11 Jan 2021 15:15:01 +0000 Subject: MLCE-326 'Support Dilation in Conv2D in ONNX and Tensorflow Parsers' Signed-off-by: Sadik Armagan Change-Id: I4a0f07b1e8f80aff0d29405def1f33bde7944e31 --- src/armnnOnnxParser/test/Conv2D.cpp | 151 ++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) (limited to 'src/armnnOnnxParser/test/Conv2D.cpp') diff --git a/src/armnnOnnxParser/test/Conv2D.cpp b/src/armnnOnnxParser/test/Conv2D.cpp index da67985107..a38cc192ed 100644 --- a/src/armnnOnnxParser/test/Conv2D.cpp +++ b/src/armnnOnnxParser/test/Conv2D.cpp @@ -438,6 +438,146 @@ struct Conv2DDimReducingFixture : public armnnUtils::ParserPrototxtFixture +{ + Conv2DwithDilationFixture() + { + m_Prototext = R"( + ir_version: 3 + producer_name: "CNTK" + producer_version: "2.5.1" + domain: "ai.cntk" + model_version: 1 + graph { + name: "CNTKGraph" + input { + name: "Input" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 1 + } + dim { + dim_value: 1 + } + dim { + dim_value: 6 + } + dim { + dim_value: 6 + } + } + } + } + } + input { + name: "Weight" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 1 + } + dim { + dim_value: 1 + } + dim { + dim_value: 3 + } + dim { + dim_value: 3 + } + } + } + } + } + initializer { + dims: 1 + dims: 1 + dims: 3 + dims: 3 + data_type: 1 + float_data: 2 + float_data: 1 + float_data: 0 + float_data: 6 + float_data: 2 + float_data: 1 + float_data: 4 + float_data: 1 + float_data: 2 + name: "Weight" + } + node { + input: "Input" + input: "Weight" + output: "Output" + name: "Convolution" + op_type: "Conv" + attribute { + name: "kernel_shape" + ints: 3 + ints: 3 + type: INTS + } + attribute { + name: "strides" + ints: 1 + ints: 1 + type: INTS + } + attribute { + name: "auto_pad" + s: "VALID" + type: STRING + } + attribute { + name: "group" + i: 1 + type: INT + } + attribute { + name: "dilations" + ints: 2 + ints: 2 + type: INTS + } + doc_string: "" + domain: "" + } + output { + name: "Output" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 1 + } + dim { + dim_value: 1 + } + dim { + dim_value: 2 + } + dim { + dim_value: 2 + } + } + } + } + } + } + opset_import { + version: 7 + })"; + Setup(); + } +}; + BOOST_FIXTURE_TEST_CASE(ValidConvTest, SimpleConv2DFixture) { RunTest<4>({{"Input", {1.0, 2.0, 3.0, @@ -466,4 +606,15 @@ BOOST_FIXTURE_TEST_CASE(ValidConvDimReducTest, Conv2DDimReducingFixture) 1, 2, 3, 4}}}); } +BOOST_FIXTURE_TEST_CASE(ValidConvWithDilationTest, Conv2DwithDilationFixture) +{ + RunTest<4>({{"Input", {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, + 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, + 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, + 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, + 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, + 7.0, 8.0, 9.0, 10.0, 11.0, 12.0}}}, + {{"Output", {39.0, 58.0, 153.0, 172.0 }}}); +} + BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.1