1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
5 #include <gtest/gtest.h>
6 #include <inference_engine/shape_infer/built-in/ie_built_in_holder.hpp>
7 #include <xml_net_builder.hpp>
8 #include <inference_engine/cnn_network_impl.hpp>
9 #include <inference_engine/ie_format_parser.h>
10 #include <xml_helper.hpp>
11 #include <inference_engine/shape_infer/ie_reshaper.hpp>
12 #include "built_in_shape_infer_general_test.hpp"
14 using namespace InferenceEngine;
15 using namespace ShapeInfer;
17 class BuiltInShapeInferImplFakeTest : public BuiltInShapeInferImplTest {
20 TEST_P(BuiltInShapeInferImplFakeTest, reshaper) {
21 auto cnnNetworkImplPtr = buildSingleLayerNetwork<3>(type, inOutShapes, &layerParams.data, layerDataName);
22 auto reshaper = std::make_shared<Reshaper>(*cnnNetworkImplPtr);
23 auto inputShapes = setInputShapes(*cnnNetworkImplPtr, newInOutShapes.inDims);
26 reshaper->run(inputShapes);
27 checkNetworkInOut(*cnnNetworkImplPtr, newInOutShapes);
29 ASSERT_THROW(reshaper->run(inputShapes), InferenceEngine::details::InferenceEngineException);
33 //TODO: use static variables for dimensions and parameters!!
34 //TODO: think about shorter instantiation
36 INSTANTIATE_TEST_CASE_P(
37 BuiltInImplsFake2, BuiltInShapeInferImplFakeTest,
39 ::testing::make_tuple(LayerType("NOT_KNOWN"),
40 InOutShapes({{{1, 2, 3, 4}, {1, 2}, {1, 2, 3}},
41 {{2, 1}, {2, 1}, {2, 1}}}),
42 NewInOutShapes({{{1, 2, 3, 4}, {1, 2}, {1, 2, 3}},
43 {{2, 1}, {2, 1}, {2, 1}}}),
44 MapParams(MapStrStr()),
45 LayerDataName("data"),
47 ::testing::make_tuple(LayerType("NOT_KNOWN"),
48 InOutShapes({{{1, 2, 3, 4}},
50 NewInOutShapes({{{BATCH, 2, 3, 4}},
52 MapParams(MapStrStr()),
53 LayerDataName("data"),
55 ::testing::make_tuple(LayerType("NOT_KNOWN"),
56 InOutShapes({{{1, 2, 3, 4}, {1, 2}},
57 {{2, 1}, {2, 1}, {2, 1}}}),
58 NewInOutShapes({{{1, 2, 3, 4}, {BATCH, 2}},
59 {{2, 1}, {2, 1}, {2, 1}}}),
60 MapParams(MapStrStr()),
61 LayerDataName("data"),
63 ::testing::make_tuple(LayerType("NOT_KNOWN"),
64 InOutShapes({{{1, 2, 3, 4}},
65 {{2, 1}, {2, 1}, {2, 1}}}),
66 NewInOutShapes({{{BATCH, 2, 3, 4}},
67 {{BATCH, 1}, {BATCH, 1}, {BATCH, 1}}}),
68 MapParams(MapStrStr()),
69 LayerDataName("data"),
71 ::testing::make_tuple(LayerType("NOT_KNOWN"),
72 InOutShapes({{{1, 2, 3, 4}},
73 {{2, 1}, {2, 1}, {2, 1}}}),
74 NewInOutShapes({{{1, BATCH, 3, 4}},
75 {{2, 1}, {2, 1}, {2, 1}}}),
76 MapParams(MapStrStr()),
77 LayerDataName("data"),