|
104 | 104 | ]
|
105 | 105 |
|
106 | 106 |
|
107 |
| -def _check_nd_call( |
108 |
| - origin_func, |
109 |
| - dpnp_func, |
110 |
| - x1, |
111 |
| - x2, |
112 |
| - out=None, |
113 |
| - where=True, |
114 |
| - order="K", |
115 |
| - dtype=None, |
116 |
| - subok=True, |
117 |
| - **kwargs, |
118 |
| -): |
119 |
| - """ |
120 |
| - Checks arguments and calls a function. |
121 |
| -
|
122 |
| - Chooses a common internal elementwise function to call in DPNP based on input arguments |
123 |
| - or to fallback on NumPy call if any passed argument is not currently supported. |
124 |
| -
|
125 |
| - """ |
126 |
| - |
127 |
| - if kwargs: |
128 |
| - pass |
129 |
| - elif where is not True: |
130 |
| - pass |
131 |
| - elif dtype is not None: |
132 |
| - pass |
133 |
| - elif subok is not True: |
134 |
| - pass |
135 |
| - elif dpnp.isscalar(x1) and dpnp.isscalar(x2): |
136 |
| - # at least either x1 or x2 has to be an array |
137 |
| - pass |
138 |
| - else: |
139 |
| - if order in "afkcAFKC": |
140 |
| - order = order.upper() |
141 |
| - elif order is None: |
142 |
| - order = "K" |
143 |
| - else: |
144 |
| - raise ValueError( |
145 |
| - "order must be one of 'C', 'F', 'A', or 'K' (got '{}')".format( |
146 |
| - order |
147 |
| - ) |
148 |
| - ) |
149 |
| - |
150 |
| - return dpnp_func(x1, x2, out=out, order=order) |
151 |
| - return call_origin( |
152 |
| - origin_func, |
153 |
| - x1, |
154 |
| - x2, |
155 |
| - out=out, |
156 |
| - where=where, |
157 |
| - order=order, |
158 |
| - dtype=dtype, |
159 |
| - subok=subok, |
160 |
| - **kwargs, |
161 |
| - ) |
162 |
| - |
163 |
| - |
164 | 107 | def abs(*args, **kwargs):
|
165 | 108 | """
|
166 | 109 | Calculate the absolute value element-wise.
|
@@ -291,7 +234,7 @@ def add(
|
291 | 234 |
|
292 | 235 | """
|
293 | 236 |
|
294 |
| - return _check_nd_call( |
| 237 | + return check_nd_call_func( |
295 | 238 | numpy.add,
|
296 | 239 | dpnp_add,
|
297 | 240 | x1,
|
@@ -689,7 +632,7 @@ def divide(
|
689 | 632 |
|
690 | 633 | """
|
691 | 634 |
|
692 |
| - return _check_nd_call( |
| 635 | + return check_nd_call_func( |
693 | 636 | numpy.divide,
|
694 | 637 | dpnp_divide,
|
695 | 638 | x1,
|
@@ -864,7 +807,7 @@ def floor_divide(
|
864 | 807 |
|
865 | 808 | """
|
866 | 809 |
|
867 |
| - return _check_nd_call( |
| 810 | + return check_nd_call_func( |
868 | 811 | numpy.floor_divide,
|
869 | 812 | dpnp_floor_divide,
|
870 | 813 | x1,
|
@@ -1256,7 +1199,7 @@ def multiply(
|
1256 | 1199 |
|
1257 | 1200 | """
|
1258 | 1201 |
|
1259 |
| - return _check_nd_call( |
| 1202 | + return check_nd_call_func( |
1260 | 1203 | numpy.multiply,
|
1261 | 1204 | dpnp_multiply,
|
1262 | 1205 | x1,
|
@@ -1725,7 +1668,7 @@ def subtract(
|
1725 | 1668 |
|
1726 | 1669 | """
|
1727 | 1670 |
|
1728 |
| - return _check_nd_call( |
| 1671 | + return check_nd_call_func( |
1729 | 1672 | numpy.subtract,
|
1730 | 1673 | dpnp_subtract,
|
1731 | 1674 | x1,
|
|
0 commit comments