blob: 03e426d4ebb9f7bf829cbc4ffacd92306a08ed7f [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{
Michalis Spyrou724079d2017-12-15 11:37:37 +000036namespace benchmark
37{
Anthony Barbier6ff3b192017-09-04 18:44:23 +010038template <typename TensorType,
39 typename Accessor,
40 typename ActivationLayerFunction,
41 typename ConvolutionLayerFunction,
42 typename FullyConnectedLayerFunction,
43 typename PoolingLayerFunction,
44 typename SoftmaxLayerFunction>
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010045class LeNet5Fixture : public framework::Fixture
Anthony Barbier6ff3b192017-09-04 18:44:23 +010046{
47public:
Moritz Pflanzerb6c8d242017-07-18 13:42:54 +010048 template <typename...>
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010049 void setup(int batches)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010050 {
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010051 network.init(batches);
52 network.build();
53 network.allocate();
Anthony Barbier6ff3b192017-09-04 18:44:23 +010054 }
55
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010056 void run()
Anthony Barbier6ff3b192017-09-04 18:44:23 +010057 {
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010058 network.run();
59 }
60
Joel Liang1c5ffd62017-12-28 10:09:51 +080061 void sync()
62 {
63 network.sync();
64 }
65
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010066 void teardown()
67 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +010068 network.clear();
69 }
70
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010071private:
72 networks::LeNet5Network<TensorType,
73 Accessor,
74 ActivationLayerFunction,
75 ConvolutionLayerFunction,
76 FullyConnectedLayerFunction,
77 PoolingLayerFunction,
78 SoftmaxLayerFunction>
79 network{};
Anthony Barbier6ff3b192017-09-04 18:44:23 +010080};
Michalis Spyrou724079d2017-12-15 11:37:37 +000081} // namespace benchmark
Anthony Barbier6ff3b192017-09-04 18:44:23 +010082} // namespace test
83} // namespace arm_compute
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010084#endif /* ARM_COMPUTE_TEST_LENET5FIXTURE */