blob: 3f36628c60757d140c9e26fa0095fd115d4bb2b9 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
2 * Copyright (c) 2017 ARM Limited.
3 *
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 Pflanzeree493ae2017-07-05 10:52:21 +010027#include "framework/Fixture.h"
28#include "networks_new/LeNet5Network.h"
Moritz Pflanzer94450f12017-06-30 12:48:43 +010029#include "tests/TensorLibrary.h"
30#include "tests/Utils.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 Pflanzeree493ae2017-07-05 10:52:21 +010046 void setup(int batches)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010047 {
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010048 network.init(batches);
49 network.build();
50 network.allocate();
Anthony Barbier6ff3b192017-09-04 18:44:23 +010051 network.fill_random();
52 }
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
59 void teardown()
60 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +010061 network.clear();
62 }
63
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010064private:
65 networks::LeNet5Network<TensorType,
66 Accessor,
67 ActivationLayerFunction,
68 ConvolutionLayerFunction,
69 FullyConnectedLayerFunction,
70 PoolingLayerFunction,
71 SoftmaxLayerFunction>
72 network{};
Anthony Barbier6ff3b192017-09-04 18:44:23 +010073};
Anthony Barbier6ff3b192017-09-04 18:44:23 +010074} // namespace test
75} // namespace arm_compute
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010076#endif /* ARM_COMPUTE_TEST_LENET5FIXTURE */