2
2
# distutils: language = c++
3
3
# -*- coding: utf-8 -*-
4
4
# *****************************************************************************
5
- # Copyright (c) 2016-2020 , Intel Corporation
5
+ # Copyright (c) 2016-2022 , Intel Corporation
6
6
# All rights reserved.
7
7
#
8
8
# Redistribution and use in source and binary forms, with or without
90
90
]
91
91
92
92
93
- def arange (start , stop = None , step = 1 , dtype = None ):
93
+ def arange (start ,
94
+ / ,
95
+ stop = None ,
96
+ step = 1 ,
97
+ * ,
98
+ dtype = None ,
99
+ like = None ,
100
+ device = None ,
101
+ usm_type = "device" ,
102
+ sycl_queue = None ):
94
103
"""
95
104
Returns an array with evenly spaced values within a given interval.
96
105
@@ -99,12 +108,11 @@ def arange(start, stop=None, step=1, dtype=None):
99
108
Returns
100
109
-------
101
110
arange : :obj:`dpnp.ndarray`
102
- The 1-D array of range values.
111
+ The 1-D array containing evenly spaced values.
103
112
104
113
Limitations
105
114
-----------
106
- Parameter ``start`` is supported as integer only.
107
- Parameters ``stop`` and ``step`` are supported as either integer or ``None``.
115
+ Parameter ``like`` is supported only with default value ``None``.
108
116
Otherwise the function will be executed sequentially on CPU.
109
117
110
118
See Also
@@ -113,7 +121,6 @@ def arange(start, stop=None, step=1, dtype=None):
113
121
114
122
Examples
115
123
--------
116
-
117
124
>>> import dpnp as np
118
125
>>> [i for i in np.arange(3)]
119
126
[0, 1, 2]
@@ -123,34 +130,15 @@ def arange(start, stop=None, step=1, dtype=None):
123
130
[3, 5]
124
131
125
132
"""
126
- if not use_origin_backend ():
127
- if not isinstance (start , int ):
128
- pass
129
- elif (stop is not None ) and (not isinstance (stop , int )):
130
- pass
131
- elif (step is not None ) and (not isinstance (step , int )):
132
- pass
133
- # TODO: modify native implementation to accept negative values
134
- elif (step is not None ) and (step < 0 ):
135
- pass
136
- elif (start is not None ) and (start < 0 ):
137
- pass
138
- elif (start is not None ) and (stop is not None ) and (start > stop ):
139
- pass
140
- elif (dtype is not None ) and (dtype not in [dpnp .int32 , dpnp .int64 , dpnp .float32 , dpnp .float64 ]):
141
- pass
142
- else :
143
- if dtype is None :
144
- dtype = numpy .int64
145
-
146
- if stop is None :
147
- stop = start
148
- start = 0
149
-
150
- if step is None :
151
- step = 1
152
133
153
- return dpnp_arange (start , stop , step , dtype ).get_pyobj ()
134
+ if like is None :
135
+ return dpnp_container .arange (start ,
136
+ stop = stop ,
137
+ step = step ,
138
+ dtype = dtype ,
139
+ device = device ,
140
+ usm_type = usm_type ,
141
+ sycl_queue = sycl_queue )
154
142
155
143
return call_origin (numpy .arange , start , stop = stop , step = step , dtype = dtype )
156
144
0 commit comments