blob: 72c90ca5457e9befba6a37636f712812f1ed2ab4 [file] [log] [blame]
Matthew Benthamf61c2702019-04-23 16:43:27 +01001//
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
11BOOST_AUTO_TEST_SUITE(FullyConnectedReshapeTests)
12
13BOOST_AUTO_TEST_CASE(TestFlattenFullyConnectedInput)
14{
15 using armnn::TensorShape;
Matthew Benthame9aa4692019-04-24 14:36:20 +010016
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
Matthew Benthamf61c2702019-04-23 16:43:27 +010022 BOOST_TEST(FlattenFullyConnectedInput(TensorShape({97,1,1,2048}), TensorShape({512, 2048})) ==
23 TensorShape({97, 2048}));
Matthew Benthame9aa4692019-04-24 14:36:20 +010024
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}));
Matthew Benthamf61c2702019-04-23 16:43:27 +010040}
41
42BOOST_AUTO_TEST_SUITE_END()