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