1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5
6 #include "../DriverTestHelpers.hpp"
7 #include "../../1.0/FullyConnected.hpp"
8
9 #include <boost/test/unit_test.hpp>
10
11 BOOST_AUTO_TEST_SUITE(FullyConnectedReshapeTests)
12
BOOST_AUTO_TEST_CASE(TestFlattenFullyConnectedInput)13 BOOST_AUTO_TEST_CASE(TestFlattenFullyConnectedInput)
14 {
15 using armnn::TensorShape;
16
17 // Pass through 2d input
18 BOOST_TEST(FlattenFullyConnectedInput(TensorShape({2,2048}), TensorShape({512, 2048})) ==
19 TensorShape({2, 2048}));
20
21 // Trivial flattening of batched channels
22 BOOST_TEST(FlattenFullyConnectedInput(TensorShape({97,1,1,2048}), TensorShape({512, 2048})) ==
23 TensorShape({97, 2048}));
24
25 // Flatten single batch of rows
26 BOOST_TEST(FlattenFullyConnectedInput(TensorShape({1,97,1,2048}), TensorShape({512, 2048})) ==
27 TensorShape({97, 2048}));
28
29 // Flatten single batch of columns
30 BOOST_TEST(FlattenFullyConnectedInput(TensorShape({1,1,97,2048}), TensorShape({512, 2048})) ==
31 TensorShape({97, 2048}));
32
33 // Move batches into input dimension
34 BOOST_TEST(FlattenFullyConnectedInput(TensorShape({50,1,1,10}), TensorShape({512, 20})) ==
35 TensorShape({25, 20}));
36
37 // Flatten single batch of 3D data (e.g. convolution output)
38 BOOST_TEST(FlattenFullyConnectedInput(TensorShape({1,16,16,10}), TensorShape({512, 2560})) ==
39 TensorShape({1, 2560}));
40 }
41
42 BOOST_AUTO_TEST_SUITE_END()
43