Skip to content

Commit 8355bd5

Browse files
committed
Update imag to use a constant value of 0 for real-valued dtypes
1 parent 8adc781 commit 8355bd5

File tree

1 file changed

+4
-2
lines changed
  • dpctl/tensor/libtensor/include/kernels/elementwise_functions

1 file changed

+4
-2
lines changed

dpctl/tensor/libtensor/include/kernels/elementwise_functions/imag.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,16 @@ using dpctl::tensor::ssize_t;
5353
namespace td_ns = dpctl::tensor::type_dispatch;
5454

5555
using dpctl::tensor::type_utils::is_complex;
56+
using dpctl::tensor::type_utils::is_complex_v;
5657

5758
template <typename argT, typename resT> struct ImagFunctor
5859
{
5960

6061
// is function constant for given argT
61-
using is_constant = typename std::false_type;
62+
using is_constant =
63+
typename std::is_same<is_complex<argT>, std::false_type>;
6264
// constant value, if constant
63-
// constexpr resT constant_value = resT{};
65+
constexpr resT constant_value = resT{0};
6466
// is function defined for sycl::vec
6567
using supports_vec = typename std::false_type;
6668
// do both argTy and resTy support sugroup store/load operation

0 commit comments

Comments
 (0)