File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -331,6 +331,8 @@ def clip(
331
331
max : Optional [Union [int , float , ndarray ]] = None ,
332
332
* ,
333
333
xp ,
334
+ # TODO: np.clip has other ufunc kwargs
335
+ out : Optional [ndarray ] = None ,
334
336
) -> ndarray :
335
337
def _isscalar (a ):
336
338
return isinstance (a , (int , float , type (None )))
@@ -366,9 +368,9 @@ def _isscalar(a):
366
368
if type (max ) is int and max >= wrapped_xp .iinfo (x .dtype ).max :
367
369
max = None
368
370
369
- out = wrapped_xp . asarray ( xp . broadcast_to ( x , result_shape ),
370
- copy = True , device = device ( x ))
371
-
371
+ if out is None :
372
+ out = wrapped_xp . asarray ( xp . broadcast_to ( x , result_shape ),
373
+ copy = True , device = device ( x ))
372
374
if min is not None :
373
375
if is_torch_array (x ) and x .dtype == xp .float64 and _isscalar (min ):
374
376
# Avoid loss of precision due to torch defaulting to float32
You can’t perform that action at this time.
0 commit comments