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_THRESHOLD_DATASET_H__ |
| 25 | #define __ARM_COMPUTE_TEST_DATASET_THRESHOLD_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 | #include <tuple> |
| 37 | #include <type_traits> |
| 38 | |
| 39 | #ifdef BOOST |
| 40 | #include "boost_wrapper.h" |
Anthony Barbier | ac69aa1 | 2017-07-03 17:39:37 +0100 | [diff] [blame^] | 41 | #endif /* BOOST */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 42 | |
| 43 | namespace arm_compute |
| 44 | { |
| 45 | namespace test |
| 46 | { |
| 47 | class ThresholdDataObject |
| 48 | { |
| 49 | public: |
| 50 | uint8_t threshold; |
| 51 | uint8_t false_value; |
| 52 | uint8_t true_value; |
| 53 | ThresholdType type; |
| 54 | uint8_t upper; |
| 55 | |
| 56 | operator std::string() const |
| 57 | { |
| 58 | std::stringstream ss; |
| 59 | ss << "Threshold"; |
| 60 | ss << "_threshold_value" << threshold; |
Georgios Pinitas | ce09314 | 2017-06-19 16:11:53 +0100 | [diff] [blame] | 61 | ss << "_false_value" << std::boolalpha << false_value; |
| 62 | ss << "_true_value" << std::boolalpha << true_value; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 63 | ss << "_type"; |
| 64 | ss << ((type == ThresholdType::BINARY) ? "binary" : "range"); |
| 65 | ss << "_upper" << upper; |
| 66 | return ss.str(); |
| 67 | } |
| 68 | |
| 69 | friend std::ostream &operator<<(std::ostream &os, const ThresholdDataObject &obj) |
| 70 | { |
| 71 | os << static_cast<std::string>(obj); |
| 72 | return os; |
| 73 | } |
| 74 | }; |
| 75 | |
| 76 | class ThresholdDataset : public GenericDataset<ThresholdDataObject, 4> |
| 77 | { |
| 78 | public: |
| 79 | ThresholdDataset() |
| 80 | : GenericDataset |
| 81 | { |
| 82 | ThresholdDataObject{ 10U, 25U, 3U, ThresholdType::BINARY, 0U }, |
| 83 | ThresholdDataObject{ 20U, 1U, 0U, ThresholdType::BINARY, 0U }, |
| 84 | ThresholdDataObject{ 30U, 1U, 0U, ThresholdType::RANGE, 100U }, |
| 85 | ThresholdDataObject{ 100U, 1U, 0U, ThresholdType::RANGE, 200U }, |
| 86 | } |
| 87 | { |
| 88 | } |
| 89 | |
| 90 | ~ThresholdDataset() = default; |
| 91 | }; |
| 92 | |
| 93 | } // namespace test |
| 94 | } // namespace arm_compute |
Anthony Barbier | ac69aa1 | 2017-07-03 17:39:37 +0100 | [diff] [blame^] | 95 | #endif /* __ARM_COMPUTE_TEST_DATASET_THRESHOLD_DATASET_H__ */ |