Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [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_DATASET_NORMALIZATION_LAYER_DATASET_H__ |
| 25 | #define __ARM_COMPUTE_TEST_DATASET_NORMALIZATION_LAYER_DATASET_H__ |
| 26 | |
| 27 | #include "TypePrinter.h" |
| 28 | |
| 29 | #include "arm_compute/core/TensorShape.h" |
| 30 | #include "arm_compute/core/Types.h" |
| 31 | #include "dataset/GenericDataset.h" |
| 32 | |
| 33 | #include <sstream> |
| 34 | #include <type_traits> |
| 35 | |
| 36 | #ifdef BOOST |
| 37 | #include "boost_wrapper.h" |
Anthony Barbier | ac69aa1 | 2017-07-03 17:39:37 +0100 | [diff] [blame] | 38 | #endif /* BOOST */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 39 | |
| 40 | namespace arm_compute |
| 41 | { |
| 42 | namespace test |
| 43 | { |
| 44 | class NormalizationLayerDataObject |
| 45 | { |
| 46 | public: |
| 47 | operator std::string() const |
| 48 | { |
| 49 | std::stringstream ss; |
| 50 | ss << "NormalizationLayer"; |
| 51 | ss << "_I" << shape; |
| 52 | ss << "_F_" << info.type(); |
| 53 | ss << "_S_" << info.norm_size(); |
| 54 | return ss.str(); |
| 55 | } |
| 56 | |
| 57 | public: |
| 58 | TensorShape shape; |
| 59 | NormalizationLayerInfo info; |
| 60 | }; |
| 61 | |
| 62 | template <unsigned int Size> |
| 63 | using NormalizationLayerDataset = GenericDataset<NormalizationLayerDataObject, Size>; |
| 64 | |
| 65 | class GoogLeNetNormalizationLayerDataset final : public NormalizationLayerDataset<2> |
| 66 | { |
| 67 | public: |
| 68 | GoogLeNetNormalizationLayerDataset() |
| 69 | : GenericDataset |
| 70 | { |
| 71 | // conv2/norm2 |
| 72 | NormalizationLayerDataObject{ TensorShape(56U, 56U, 192U), NormalizationLayerInfo(NormType::CROSS_MAP, 5, 0.0001f, 0.75f) }, |
| 73 | // pool1/norm1 |
| 74 | NormalizationLayerDataObject{ TensorShape(56U, 56U, 64U), NormalizationLayerInfo(NormType::CROSS_MAP, 5, 0.0001f, 0.75f) } |
| 75 | } |
| 76 | { |
| 77 | } |
| 78 | |
| 79 | ~GoogLeNetNormalizationLayerDataset() = default; |
| 80 | }; |
| 81 | |
| 82 | class AlexNetNormalizationLayerDataset final : public NormalizationLayerDataset<2> |
| 83 | { |
| 84 | public: |
| 85 | AlexNetNormalizationLayerDataset() |
| 86 | : GenericDataset |
| 87 | { |
| 88 | NormalizationLayerDataObject{ TensorShape(55U, 55U, 96U), NormalizationLayerInfo(NormType::CROSS_MAP, 5, 0.0001f, 0.75f) }, |
| 89 | NormalizationLayerDataObject{ TensorShape(27U, 27U, 256U), NormalizationLayerInfo(NormType::CROSS_MAP, 5, 0.0001f, 0.75f) }, |
| 90 | } |
| 91 | { |
| 92 | } |
| 93 | |
| 94 | ~AlexNetNormalizationLayerDataset() = default; |
| 95 | }; |
| 96 | |
| 97 | } // namespace test |
| 98 | } // namespace arm_compute |
Anthony Barbier | ac69aa1 | 2017-07-03 17:39:37 +0100 | [diff] [blame] | 99 | #endif /* __ARM_COMPUTE_TEST_DATASET_NORMALIZATION_LAYER_DATASET_H__ */ |