Compute Library
 23.11
DatasetModes.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2019 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_MODES
25 #define ARM_COMPUTE_TEST_DATASET_MODES
26 
27 #include <istream>
28 #include <ostream>
29 #include <sstream>
30 #include <stdexcept>
31 #include <string>
32 
33 namespace arm_compute
34 {
35 namespace test
36 {
37 namespace framework
38 {
39 /** Possible dataset modes. */
40 enum class DatasetMode : unsigned int
41 {
42  ALL = ~0U,
43  DISABLED = 0,
44  PRECOMMIT = 1,
45  NIGHTLY = 2
46 };
47 
49 {
51  return static_cast<DatasetMode>(static_cast<type>(t1) & static_cast<type>(t2));
52 }
53 
55 {
57  return static_cast<DatasetMode>(static_cast<type>(t1) | static_cast<type>(t2));
58 }
59 
61 {
63  t1 = static_cast<DatasetMode>(static_cast<type>(t1) | static_cast<type>(t2));
64  return t1;
65 }
66 
67 DatasetMode dataset_mode_from_name(const std::string &name);
68 
69 inline ::std::istream &operator>>(::std::istream &stream, DatasetMode &mode)
70 {
71  std::string value;
72  stream >> value;
74  return stream;
75 }
76 
77 inline ::std::ostream &operator<<(::std::ostream &stream, DatasetMode mode)
78 {
79  switch(mode)
80  {
82  stream << "DISABLED";
83  break;
85  stream << "PRECOMMIT";
86  break;
88  stream << "NIGHTLY";
89  break;
90  case DatasetMode::ALL:
91  stream << "ALL";
92  break;
93  default:
94  throw std::invalid_argument("Unsupported dataset mode");
95  }
96 
97  return stream;
98 }
99 
100 inline std::string to_string(DatasetMode mode)
101 {
102  std::stringstream stream;
103  stream << mode;
104  return stream.str();
105 }
106 } // namespace framework
107 } // namespace test
108 } // namespace arm_compute
109 #endif /* ARM_COMPUTE_TEST_DATASET_MODES */
type
decltype(strategy::transforms) typedef type
Definition: gemm_interleaved.hpp:261
arm_compute::test::framework::dataset_mode_from_name
DatasetMode dataset_mode_from_name(const std::string &name)
Definition: DatasetModes.cpp:36
arm_compute::test::framework::to_string
std::string to_string(DatasetMode mode)
Definition: DatasetModes.h:100
arm_compute::test::framework::operator|
DatasetMode operator|(DatasetMode t1, DatasetMode t2)
Definition: DatasetModes.h:54
arm_compute::test::framework::operator>>
inline ::std::istream & operator>>(::std::istream &stream, DatasetMode &mode)
Definition: DatasetModes.h:69
arm_compute::utils::cast::U
U
Definition: SaturateCast.h:65
arm_compute::test::framework::DatasetMode::ALL
@ ALL
arm_compute::test::framework::DatasetMode::NIGHTLY
@ NIGHTLY
name
const char * name
Definition: NEBatchNormalizationLayerKernel.cpp:66
arm_compute::test::framework::operator|=
DatasetMode & operator|=(DatasetMode &t1, DatasetMode t2)
Definition: DatasetModes.h:60
arm_compute::test::framework::DatasetMode::PRECOMMIT
@ PRECOMMIT
arm_compute::test::framework::DatasetMode::DISABLED
@ DISABLED
arm_compute
Copyright (c) 2017-2023 Arm Limited.
Definition: introduction.dox:24
arm_compute::test::framework::operator<<
inline ::std::ostream & operator<<(::std::ostream &stream, DatasetMode mode)
Definition: DatasetModes.h:77
clang_tidy_rules.mode
mode
Definition: clang_tidy_rules.py:196
arm_compute::test::framework::DatasetMode
DatasetMode
Possible dataset modes.
Definition: DatasetModes.h:40
arm_compute::test::framework::operator&
DatasetMode operator&(DatasetMode t1, DatasetMode t2)
Definition: DatasetModes.h:48