blob: db34f6813ae170027fe14f3492414862ae2a9167 [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 */
24#ifndef __ARM_COMPUTE_TEST_BENCHMARK_LENET5_H__
25#define __ARM_COMPUTE_TEST_BENCHMARK_LENET5_H__
26
27#include "TensorLibrary.h"
28#include "Utils.h"
29
30#include "benchmark/Profiler.h"
31#include "benchmark/WallClockTimer.h"
32
33#include "model_objects/LeNet5.h"
34
35using namespace arm_compute;
36using namespace arm_compute::test;
37using namespace arm_compute::test::benchmark;
38
39namespace arm_compute
40{
41namespace test
42{
43namespace benchmark
44{
45template <typename TensorType,
46 typename Accessor,
47 typename ActivationLayerFunction,
48 typename ConvolutionLayerFunction,
49 typename FullyConnectedLayerFunction,
50 typename PoolingLayerFunction,
51 typename SoftmaxLayerFunction>
52class LeNet5Fixture : public ::benchmark::Fixture
53{
54public:
55 void SetUp(::benchmark::State &state) override
56 {
57 profiler.add(std::make_shared<WallClockTimer>());
58
59 network.build(static_cast<unsigned int>(state.range(0)));
60 network.fill_random();
61 }
62
63 void TearDown(::benchmark::State &state) override
64 {
65 profiler.submit(state);
66 network.clear();
67 }
68
69 Profiler profiler{};
70 model_objects::LeNet5<TensorType,
71 Accessor,
72 ActivationLayerFunction,
73 ConvolutionLayerFunction,
74 FullyConnectedLayerFunction,
75 PoolingLayerFunction,
76 SoftmaxLayerFunction>
77 network{};
78};
79} // namespace benchmark
80} // namespace test
81} // namespace arm_compute
82#endif //__ARM_COMPUTE_TEST_BENCHMARK_LENET5_H__