blob: 4662feb9186295c0e9f91d3ef84fc00a9fcdc1ce [file] [log] [blame]
Moritz Pflanzeree493ae2017-07-05 10:52:21 +01001/*
Anthony Barbier72856ab2018-01-11 10:45:24 +00002 * Copyright (c) 2017-2018 ARM Limited.
Moritz Pflanzeree493ae2017-07-05 10:52:21 +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 */
24#ifndef ARM_COMPUTE_TEST_ALEXNETFIXTURE
25#define ARM_COMPUTE_TEST_ALEXNETFIXTURE
26
Moritz Pflanzerfb5aabb2017-07-18 14:39:55 +010027#include "tests/AssetsLibrary.h"
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010028#include "tests/Utils.h"
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010029#include "tests/framework/Fixture.h"
30#include "tests/networks/AlexNetNetwork.h"
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010031
32namespace arm_compute
33{
34namespace test
35{
Michalis Spyrou724079d2017-12-15 11:37:37 +000036namespace benchmark
37{
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010038template <typename ITensorType,
39 typename TensorType,
40 typename SubTensorType,
41 typename Accessor,
42 typename ActivationLayerFunction,
43 typename ConvolutionLayerFunction,
steniu01a629da12017-07-28 14:40:58 +010044 typename DirectConvolutionLayerFunction,
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010045 typename FullyConnectedLayerFunction,
46 typename NormalizationLayerFunction,
47 typename PoolingLayerFunction,
48 typename SoftmaxLayerFunction>
49
50class AlexNetFixture : public framework::Fixture
51{
52public:
Moritz Pflanzerb6c8d242017-07-18 13:42:54 +010053 template <typename...>
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010054 void setup(DataType data_type, int batches)
55 {
Vidhya Sudhan Loganathan014333d2018-07-02 09:13:49 +010056 constexpr bool weights_reshaped = false;
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010057
Vidhya Sudhan Loganathan014333d2018-07-02 09:13:49 +010058 network.init(data_type, batches, weights_reshaped);
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010059 network.build();
60 network.allocate();
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010061 }
62
63 void run()
64 {
65 network.run();
66 }
67
Joel Liang1c5ffd62017-12-28 10:09:51 +080068 void sync()
69 {
70 network.sync();
71 }
72
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010073 void teardown()
74 {
75 network.clear();
76 }
77
78private:
79 networks::AlexNetNetwork<ITensorType,
80 TensorType,
81 SubTensorType,
82 Accessor,
83 ActivationLayerFunction,
84 ConvolutionLayerFunction,
steniu01a629da12017-07-28 14:40:58 +010085 DirectConvolutionLayerFunction,
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010086 FullyConnectedLayerFunction,
87 NormalizationLayerFunction,
88 PoolingLayerFunction,
89 SoftmaxLayerFunction>
90 network{};
91};
Michalis Spyrou724079d2017-12-15 11:37:37 +000092} // namespace benchmark
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010093} // namespace test
94} // namespace arm_compute
95#endif /* ARM_COMPUTE_TEST_ALEXNETFIXTURE */