Skip to content

Commit 0369ad3

Browse files
fix arange func (#773)
1 parent e2d26e1 commit 0369ad3

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

dpnp/dpnp_algo/dpnp_algo.pyx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ ctypedef void(*fptr_dpnp_initval_t)(void * , void * , size_t)
7575

7676

7777
cpdef dparray dpnp_arange(start, stop, step, dtype):
78-
79-
if step is not 1:
80-
raise ValueError("DPNP dpnp_arange(): `step` is not supported")
81-
8278
obj_len = int(numpy.ceil((stop - start) / step))
8379
if obj_len < 0:
8480
raise ValueError(f"DPNP dpnp_arange(): Negative array size (start={start},stop={stop},step={step})")

dpnp/dpnp_iface_arraycreation.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,22 @@ def arange(start, stop=None, step=1, dtype=None):
121121
if not use_origin_backend():
122122
if not isinstance(start, int):
123123
pass
124-
elif not isinstance(stop, int) or stop is not None:
124+
elif (stop is not None) and (not isinstance(stop, int)):
125125
pass
126-
elif not isinstance(step, int) or step is not None:
126+
elif (step is not None) and (not isinstance(step, int)):
127+
pass
128+
# TODO: modify native implementation to accept negative values
129+
elif (step is not None) and (step < 0):
130+
pass
131+
elif (start is not None) and (start < 0):
132+
pass
133+
elif (start is not None) and (stop is not None) and (start > stop):
134+
pass
135+
elif (dtype is not None) and (dtype not in [dpnp.int32, dpnp.int64, dpnp.float32, dpnp.float64]):
127136
pass
128137
else:
129138
if dtype is None:
130-
dtype = numpy.float64
139+
dtype = numpy.int64
131140

132141
if stop is None:
133142
stop = start

0 commit comments

Comments
 (0)