Georgios Pinitas | 236bfe7 | 2017-11-23 15:59:55 +0000 | [diff] [blame] | 1 | /* |
| 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_MOBILENETV1_FIXTURE |
| 25 | #define ARM_COMPUTE_TEST_MOBILENETV1_FIXTURE |
| 26 | |
| 27 | #include "tests/AssetsLibrary.h" |
| 28 | #include "tests/Utils.h" |
| 29 | #include "tests/framework/Fixture.h" |
| 30 | #include "tests/networks/MobileNetV1Network.h" |
| 31 | |
| 32 | namespace arm_compute |
| 33 | { |
| 34 | namespace test |
| 35 | { |
| 36 | template <typename TensorType, |
| 37 | typename Accessor, |
| 38 | typename ActivationLayerFunction, |
| 39 | typename BatchNormalizationLayerFunction, |
| 40 | typename ConvolutionLayerFunction, |
| 41 | typename DirectConvolutionLayerFunction, |
| 42 | typename DepthwiseConvolutionFunction, |
| 43 | typename ReshapeFunction, |
| 44 | typename PoolingLayerFunction, |
| 45 | typename SoftmaxLayerFunction, |
| 46 | unsigned int InputSize> |
| 47 | class MobileNetV1Fixture : public framework::Fixture |
| 48 | { |
| 49 | public: |
| 50 | template <typename...> |
| 51 | void setup(int batches) |
| 52 | { |
| 53 | network.init(InputSize, batches); |
| 54 | network.build(); |
| 55 | network.allocate(); |
| 56 | network.fill_random(); |
| 57 | } |
| 58 | |
| 59 | void run() |
| 60 | { |
| 61 | network.run(); |
| 62 | } |
| 63 | |
| 64 | void teardown() |
| 65 | { |
| 66 | network.clear(); |
| 67 | } |
| 68 | |
| 69 | private: |
| 70 | networks::MobileNetV1Network<TensorType, |
| 71 | Accessor, |
| 72 | ActivationLayerFunction, |
| 73 | BatchNormalizationLayerFunction, |
| 74 | ConvolutionLayerFunction, |
| 75 | DirectConvolutionLayerFunction, |
| 76 | DepthwiseConvolutionFunction, |
| 77 | ReshapeFunction, |
| 78 | PoolingLayerFunction, |
| 79 | SoftmaxLayerFunction> |
| 80 | network{}; |
| 81 | }; |
| 82 | } // namespace test |
| 83 | } // namespace arm_compute |
| 84 | #endif /* ARM_COMPUTE_TEST_MOBILENETV1_FIXTURE */ |