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_BATCH_NORMALIZATION_LAYER_DATASET_H__ |
| 25 | #define __ARM_COMPUTE_TEST_DATASET_BATCH_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 <ostream> |
| 34 | #include <sstream> |
| 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 BatchNormalizationLayerDataObject |
| 45 | { |
| 46 | public: |
| 47 | operator std::string() const |
| 48 | { |
| 49 | std::stringstream ss; |
| 50 | ss << "BatchNormalizationLayer"; |
| 51 | ss << "_I" << shape0; |
| 52 | ss << "_I" << shape1; |
| 53 | ss << "_I" << epsilon; |
| 54 | return ss.str(); |
| 55 | } |
| 56 | |
| 57 | friend std::ostream &operator<<(std::ostream &s, const BatchNormalizationLayerDataObject &obj) |
| 58 | { |
| 59 | s << static_cast<std::string>(obj); |
| 60 | return s; |
| 61 | } |
| 62 | |
| 63 | public: |
| 64 | TensorShape shape0; |
| 65 | TensorShape shape1; |
| 66 | float epsilon; |
| 67 | }; |
| 68 | |
| 69 | template <unsigned int Size> |
| 70 | using BatchNormalizationLayerDataset = GenericDataset<BatchNormalizationLayerDataObject, Size>; |
| 71 | |
| 72 | class RandomBatchNormalizationLayerDataset final : public BatchNormalizationLayerDataset<3> |
| 73 | { |
| 74 | public: |
| 75 | RandomBatchNormalizationLayerDataset() |
| 76 | : GenericDataset |
| 77 | { |
| 78 | BatchNormalizationLayerDataObject{ TensorShape(15U, 16U, 2U, 12U), TensorShape(2U), 0.1f }, |
| 79 | BatchNormalizationLayerDataObject{ TensorShape(21U, 11U, 12U, 7U), TensorShape(12U), 0.1f }, |
| 80 | BatchNormalizationLayerDataObject{ TensorShape(7U, 3U, 6U, 11U), TensorShape(6U), 0.1f }, |
| 81 | } |
| 82 | { |
| 83 | } |
| 84 | |
| 85 | ~RandomBatchNormalizationLayerDataset() = default; |
| 86 | }; |
| 87 | |
| 88 | } // namespace test |
| 89 | } // namespace arm_compute |
| 90 | #endif //__ARM_COMPUTE_TEST_DATASET_BATCH_NORMALIZATION_LAYER_DATASET_H__ |