blob: 51080428202266cc0e0aa805f8deafa92e9674be [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
Anthony Barbier72856ab2018-01-11 10:45:24 +00002 * Copyright (c) 2017-2018 ARM Limited.
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010024#ifndef ARM_COMPUTE_TEST_LENET5FIXTURE
25#define ARM_COMPUTE_TEST_LENET5FIXTURE
Anthony Barbier6ff3b192017-09-04 18:44:23 +010026
Moritz Pflanzerfb5aabb2017-07-18 14:39:55 +010027#include "tests/AssetsLibrary.h"
Moritz Pflanzer94450f12017-06-30 12:48:43 +010028#include "tests/Utils.h"
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010029#include "tests/framework/Fixture.h"
30#include "tests/networks/LeNet5Network.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010031
Anthony Barbier6ff3b192017-09-04 18:44:23 +010032namespace arm_compute
33{
34namespace test
35{
Anthony Barbier6ff3b192017-09-04 18:44:23 +010036template <typename TensorType,
37 typename Accessor,
38 typename ActivationLayerFunction,
39 typename ConvolutionLayerFunction,
40 typename FullyConnectedLayerFunction,
41 typename PoolingLayerFunction,
42 typename SoftmaxLayerFunction>
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010043class LeNet5Fixture : public framework::Fixture
Anthony Barbier6ff3b192017-09-04 18:44:23 +010044{
45public:
Moritz Pflanzerb6c8d242017-07-18 13:42:54 +010046 template <typename...>
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010047 void setup(int batches)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010048 {
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010049 network.init(batches);
50 network.build();
51 network.allocate();
Anthony Barbier6ff3b192017-09-04 18:44:23 +010052 }
53
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010054 void run()
Anthony Barbier6ff3b192017-09-04 18:44:23 +010055 {
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010056 network.run();
57 }
58
Joel Liang1c5ffd62017-12-28 10:09:51 +080059 void sync()
60 {
61 network.sync();
62 }
63
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010064 void teardown()
65 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +010066 network.clear();
67 }
68
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010069private:
70 networks::LeNet5Network<TensorType,
71 Accessor,
72 ActivationLayerFunction,
73 ConvolutionLayerFunction,
74 FullyConnectedLayerFunction,
75 PoolingLayerFunction,
76 SoftmaxLayerFunction>
77 network{};
Anthony Barbier6ff3b192017-09-04 18:44:23 +010078};
Anthony Barbier6ff3b192017-09-04 18:44:23 +010079} // namespace test
80} // namespace arm_compute
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010081#endif /* ARM_COMPUTE_TEST_LENET5FIXTURE */