Skip to content

Commit b89f41a

Browse files
Move value_type_of to ext/common.hpp
1 parent 82c657e commit b89f41a

File tree

3 files changed

+18
-24
lines changed

3 files changed

+18
-24
lines changed

dpnp/backend/extensions/common/ext/common.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,18 @@ struct IsNan
106106
}
107107
};
108108

109+
template <typename T>
110+
struct value_type_of
111+
{
112+
using type = T;
113+
};
114+
115+
template <typename T>
116+
struct value_type_of<std::complex<T>>
117+
{
118+
using type = T;
119+
};
120+
109121
size_t get_max_local_size(const sycl::device &device);
110122
size_t get_max_local_size(const sycl::device &device,
111123
int cpu_local_size_limit,

dpnp/backend/extensions/ufunc/elementwise_functions/interpolate.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@
3636

3737
#include "kernels/elementwise_functions/interpolate.hpp"
3838

39+
#include "ext/common.hpp"
3940
#include "ext/validation_utils.hpp"
4041

4142
namespace py = pybind11;
4243
namespace td_ns = dpctl::tensor::type_dispatch;
4344

45+
using ext::common::value_type_of;
4446
using ext::validation::array_names;
4547
using ext::validation::array_ptr;
4648
using ext::validation::common_checks;
@@ -51,18 +53,6 @@ namespace dpnp::extensions::ufunc
5153
namespace impl
5254
{
5355

54-
template <typename T>
55-
struct value_type_of
56-
{
57-
using type = T;
58-
};
59-
60-
template <typename T>
61-
struct value_type_of<std::complex<T>>
62-
{
63-
using type = T;
64-
};
65-
6656
template <typename T>
6757
using value_type_of_t = typename value_type_of<T>::type;
6858

dpnp/backend/extensions/ufunc/elementwise_functions/nan_to_num.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,20 @@
5252
#include "utils/type_dispatch.hpp"
5353
#include "utils/type_utils.hpp"
5454

55+
#include "ext/common.hpp"
56+
5557
namespace py = pybind11;
5658
namespace td_ns = dpctl::tensor::type_dispatch;
5759

60+
using ext::common::value_type_of;
61+
5862
// declare pybind11 wrappers in py_internal namespace
5963
namespace dpnp::extensions::ufunc
6064
{
6165

6266
namespace impl
6367
{
6468

65-
template <typename T>
66-
struct value_type_of
67-
{
68-
using type = T;
69-
};
70-
71-
template <typename T>
72-
struct value_type_of<std::complex<T>>
73-
{
74-
using type = T;
75-
};
76-
7769
template <typename T>
7870
using value_type_of_t = typename value_type_of<T>::type;
7971

0 commit comments

Comments
 (0)