blob: e5a1e375ffecb7985dc7d195727d35f77a7a4cc1 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
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 Barbierac69aa12017-07-03 17:39:37 +010041#endif /* BOOST */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010042
43namespace arm_compute
44{
45namespace test
46{
47class ThresholdDataObject
48{
49public:
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 Pinitasce093142017-06-19 16:11:53 +010061 ss << "_false_value" << std::boolalpha << false_value;
62 ss << "_true_value" << std::boolalpha << true_value;
Anthony Barbier6ff3b192017-09-04 18:44:23 +010063 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
76class ThresholdDataset : public GenericDataset<ThresholdDataObject, 4>
77{
78public:
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 Barbierac69aa12017-07-03 17:39:37 +010095#endif /* __ARM_COMPUTE_TEST_DATASET_THRESHOLD_DATASET_H__ */