aboutsummaryrefslogtreecommitdiff
path: root/test/1.0/FullyConnectedReshape.cpp
blob: e481f2d2067456be7213b4f0afa6299572c97323 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//

#include "../DriverTestHelpers.hpp"

DOCTEST_TEST_SUITE("FullyConnectedReshapeTests")
{
DOCTEST_TEST_CASE("TestFlattenFullyConnectedInput")
{
    using armnn::TensorShape;

    // Pass through 2d input
    DOCTEST_CHECK(FlattenFullyConnectedInput(TensorShape({2,2048}),
                                             TensorShape({512, 2048})) == TensorShape({2, 2048}));

    // Trivial flattening of batched channels
    DOCTEST_CHECK(FlattenFullyConnectedInput(TensorShape({97,1,1,2048}),
                                             TensorShape({512, 2048})) == TensorShape({97, 2048}));

    // Flatten single batch of rows
    DOCTEST_CHECK(FlattenFullyConnectedInput(TensorShape({1,97,1,2048}),
                                             TensorShape({512, 2048})) == TensorShape({97, 2048}));

    // Flatten single batch of columns
    DOCTEST_CHECK(FlattenFullyConnectedInput(TensorShape({1,1,97,2048}),
                                             TensorShape({512, 2048})) == TensorShape({97, 2048}));

    // Move batches into input dimension
    DOCTEST_CHECK(FlattenFullyConnectedInput(TensorShape({50,1,1,10}),
                                             TensorShape({512, 20})) == TensorShape({25, 20}));

    // Flatten single batch of 3D data (e.g. convolution output)
    DOCTEST_CHECK(FlattenFullyConnectedInput(TensorShape({1,16,16,10}),
                                             TensorShape({512, 2560})) == TensorShape({1, 2560}));
}

}