diff --git a/dpnp/dpnp_utils/dpnp_algo_utils.pyx b/dpnp/dpnp_utils/dpnp_algo_utils.pyx index 269d21a15e2..b69bceea9e6 100644 --- a/dpnp/dpnp_utils/dpnp_algo_utils.pyx +++ b/dpnp/dpnp_utils/dpnp_algo_utils.pyx @@ -201,7 +201,11 @@ def call_origin(function, *args, **kwargs): for res_origin in result: res = res_origin if isinstance(res_origin, numpy.ndarray): - res = dpnp_container.empty(res_origin.shape, dtype=res_origin.dtype, sycl_queue=exec_q) + if exec_q is not None: + result_dtype = map_dtype_to_device(res_origin.dtype, exec_q.sycl_device) + else: + result_dtype = res_origin.d_type + res = dpnp_container.empty(res_origin.shape, dtype=result_dtype, sycl_queue=exec_q) copy_from_origin(res, res_origin) result_list.append(res) diff --git a/tests/test_histograms.py b/tests/test_histograms.py index eeb8cbf563f..b62f653b0c9 100644 --- a/tests/test_histograms.py +++ b/tests/test_histograms.py @@ -15,12 +15,12 @@ def teardown(self): def test_simple(self): n = 100 v = dpnp.random.rand(n) - (a, b) = dpnp.histogram(v) + a, _ = dpnp.histogram(v) # check if the sum of the bins equals the number of samples numpy.testing.assert_equal(dpnp.sum(a, axis=0), n) # check that the bin counts are evenly spaced when the data is from # a linear function - (a, b) = dpnp.histogram(numpy.linspace(0, 10, 100)) + a, _ = dpnp.histogram(dpnp.linspace(0, 10, 100)) numpy.testing.assert_array_equal(a, 10) @pytest.mark.usefixtures("allow_fall_back_on_numpy") @@ -67,7 +67,7 @@ def test_density(self): # Taken from a bug report from N. Becker on the numpy-discussion # mailing list Aug. 6, 2010. - counts, dmy = dpnp.histogram( + counts, _ = dpnp.histogram( [1, 2, 3, 4], [0.5, 1.5, numpy.inf], density=True ) numpy.testing.assert_equal(counts, [0.25, 0])