Matthew Bentham | f61c270 | 2019-04-23 16:43:27 +0100 | [diff] [blame] | 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 | |
| 13 | BOOST_AUTO_TEST_CASE(TestFlattenFullyConnectedInput) |
| 14 | { |
| 15 | using armnn::TensorShape; |
Matthew Bentham | e9aa469 | 2019-04-24 14:36:20 +0100 | [diff] [blame] | 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 |
Matthew Bentham | f61c270 | 2019-04-23 16:43:27 +0100 | [diff] [blame] | 22 | BOOST_TEST(FlattenFullyConnectedInput(TensorShape({97,1,1,2048}), TensorShape({512, 2048})) == |
| 23 | TensorShape({97, 2048})); |
Matthew Bentham | e9aa469 | 2019-04-24 14:36:20 +0100 | [diff] [blame] | 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})); |
Matthew Bentham | f61c270 | 2019-04-23 16:43:27 +0100 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | BOOST_AUTO_TEST_SUITE_END() |