Skip to content

Commit

Permalink
Fix remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad-perevezentsev committed Jul 14, 2023
1 parent d7e874e commit 206ae7e
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 191 deletions.
2 changes: 0 additions & 2 deletions dpnp/backend/include/dpnp_iface_fptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,6 @@ enum class DPNPFuncName : size_t
parameters */
DPNP_FN_PLACE, /**< Used in numpy.place() impl */
DPNP_FN_POWER, /**< Used in numpy.power() impl */
DPNP_FN_POWER_EXT, /**< Used in numpy.power() impl, requires extra
parameters */
DPNP_FN_PROD, /**< Used in numpy.prod() impl */
DPNP_FN_PROD_EXT, /**< Used in numpy.prod() impl, requires extra parameters
*/
Expand Down
7 changes: 0 additions & 7 deletions dpnp/backend/kernels/dpnp_krnl_elemwise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1628,13 +1628,6 @@ static void func_map_elemwise_2arg_3type_core(func_map_t &fmap)
func_type_map_t::find_type<FT1>,
func_type_map_t::find_type<FTs>>}),
...);
((fmap[DPNPFuncName::DPNP_FN_POWER_EXT][FT1][FTs] =
{populate_func_types<FT1, FTs>(),
(void *)dpnp_power_c_ext<
func_type_map_t::find_type<populate_func_types<FT1, FTs>()>,
func_type_map_t::find_type<FT1>,
func_type_map_t::find_type<FTs>>}),
...);
((fmap[DPNPFuncName::DPNP_FN_SUBTRACT_EXT][FT1][FTs] =
{populate_func_types<FT1, FTs>(),
(void *)dpnp_subtract_c_ext<
Expand Down
2 changes: 0 additions & 2 deletions dpnp/dpnp_algo/dpnp_algo.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,6 @@ cdef extern from "dpnp_iface_fptr.hpp" namespace "DPNPFuncName": # need this na
DPNP_FN_PARTITION
DPNP_FN_PARTITION_EXT
DPNP_FN_PLACE
DPNP_FN_POWER
DPNP_FN_POWER_EXT
DPNP_FN_PROD
DPNP_FN_PROD_EXT
DPNP_FN_PTP
Expand Down
6 changes: 4 additions & 2 deletions dpnp/dpnp_iface_mathematical.py
Original file line number Diff line number Diff line change
Expand Up @@ -1427,8 +1427,10 @@ def power(
>>> a = dp.array([1, 2, 3, 4, 5])
>>> b = dp.array([2, 2, 2, 2, 2])
>>> result = dp.power(a, b)
>>> [x for x in result]
[1, 4, 9, 16, 25]
>>> result
array([ 1, 4, 9, 16, 25])
>>> dp.power(a, 3)
array([ 1, 8, 27, 64, 125])
"""

Expand Down
12 changes: 10 additions & 2 deletions tests/test_mathematical.py
Original file line number Diff line number Diff line change
Expand Up @@ -993,9 +993,17 @@ def test_integer_power_of_0_or_1(self, val, dtype):
@pytest.mark.parametrize("dtype", [dpnp.int32, dpnp.int64])
def test_integer_to_negative_power(self, dtype):
a = dpnp.arange(2, 10, dtype=dtype)
b = dpnp.full(8, -2, dtype=dtype)
zeros = dpnp.zeros(8, dtype=dtype)

assert_equal(a ** (-3), zeros)
ones = dpnp.ones(8, dtype=dtype)

assert_array_equal(ones ** (-2), zeros)
assert_equal(
a ** (-3), zeros
) # positive integer to negative integer power
assert_equal(
b ** (-4), zeros
) # negative integer to negative integer power

def test_float_to_inf(self):
a = numpy.array(
Expand Down
Loading

0 comments on commit 206ae7e

Please sign in to comment.