Skip to content

Commit 470fe1d

Browse files
committed
Explicitly cast an input to numpy array within pad utils function _as_pairs
1 parent ba75136 commit 470fe1d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

dpnp/dpnp_utils/dpnp_utils_pad.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ def _as_pairs(x, ndim, as_index=False):
7474
x = round(x)
7575
return ((x, x),) * ndim
7676

77-
x = numpy.array(x)
77+
# explicitly cast input "x" to NumPy array
78+
if dpnp.is_supported_array_type(x):
79+
x = dpnp.asnumpy(x)
80+
else:
81+
x = numpy.array(x)
82+
7883
if as_index:
7984
x = numpy.asarray(numpy.round(x), dtype=numpy.intp)
8085

0 commit comments

Comments
 (0)