@@ -697,7 +697,7 @@ def full(shape,
697
697
"""
698
698
if like is not None :
699
699
pass
700
- elif not isinstance ( order , str ) or len ( order ) != 1 or order not in "CcFf" :
700
+ elif order not in ( 'C' , 'c' , 'F' , 'f' , None ) :
701
701
pass
702
702
else :
703
703
return dpnp_container .full (shape ,
@@ -752,14 +752,14 @@ def full_like(x1,
752
752
"""
753
753
if not isinstance (x1 , dpnp .ndarray ):
754
754
pass
755
- elif not isinstance ( order , str ) or len ( order ) != 1 or order not in "CcFf" :
755
+ elif order not in ( 'C' , 'c' , 'F' , 'f' , None ) :
756
756
pass
757
757
elif subok is not False :
758
758
pass
759
759
else :
760
- _shape = shape if shape is not None else x1 . shape
761
- _dtype = dtype if dtype is not None else x1 . dtype
762
- _usm_type = usm_type if usm_type is not None else x1 . usm_type
760
+ _shape = x1 . shape if shape is None else shape
761
+ _dtype = x1 . dtype if dtype is None else dtype
762
+ _usm_type = x1 . usm_type if usm_type is None else usm_type
763
763
_sycl_queue = dpnp .get_normalized_queue_device (x1 , sycl_queue = sycl_queue , device = device )
764
764
765
765
return dpnp_container .full (_shape ,
@@ -1372,15 +1372,24 @@ def vander(x1, N=None, increasing=False):
1372
1372
return call_origin (numpy .vander , x1 , N = N , increasing = increasing )
1373
1373
1374
1374
1375
- def zeros (shape , dtype = None , order = 'C' ):
1375
+ def zeros (shape ,
1376
+ * ,
1377
+ dtype = None ,
1378
+ order = "C" ,
1379
+ like = None ,
1380
+ device = None ,
1381
+ usm_type = "device" ,
1382
+ sycl_queue = None ):
1376
1383
"""
1377
1384
Return a new array of given shape and type, filled with zeros.
1378
1385
1379
1386
For full documentation refer to :obj:`numpy.zeros`.
1380
1387
1381
1388
Limitations
1382
1389
-----------
1383
- Parameter ``order`` is supported only with default value ``"C"``.
1390
+ Parameter ``order`` is supported only with values ``"C"`` and ``"F"``.
1391
+ Parameter ``like`` is supported only with default value ``None``.
1392
+ Otherwise the function will be executed sequentially on CPU.
1384
1393
1385
1394
See Also
1386
1395
--------
@@ -1401,30 +1410,41 @@ def zeros(shape, dtype=None, order='C'):
1401
1410
[0.0, 0.0]
1402
1411
1403
1412
"""
1413
+ if like is not None :
1414
+ pass
1415
+ elif order not in ('C' , 'c' , 'F' , 'f' , None ):
1416
+ pass
1417
+ else :
1418
+ return dpnp_container .zeros (shape ,
1419
+ dtype = dtype ,
1420
+ order = order ,
1421
+ device = device ,
1422
+ usm_type = usm_type ,
1423
+ sycl_queue = sycl_queue )
1404
1424
1405
- if (not use_origin_backend ()):
1406
- if order not in ('C' , 'c' , None ):
1407
- pass
1408
- else :
1409
- _dtype = dtype if dtype is not None else dpnp .float64
1410
- result = dpnp_zeros (shape , _dtype ).get_pyobj ()
1411
-
1412
- return result
1413
-
1414
- return call_origin (numpy .zeros , shape , dtype = dtype , order = order )
1425
+ return call_origin (numpy .zeros , shape , dtype = dtype , order = order , like = like )
1415
1426
1416
1427
1417
- # numpy.zeros_like(a, dtype=None, order='K', subok=True, shape=None)
1418
- def zeros_like (x1 , dtype = None , order = 'C' , subok = False , shape = None ):
1428
+ def zeros_like (x1 ,
1429
+ * ,
1430
+ dtype = None ,
1431
+ order = "C" ,
1432
+ subok = False ,
1433
+ shape = None ,
1434
+ device = None ,
1435
+ usm_type = None ,
1436
+ sycl_queue = None ):
1419
1437
"""
1420
1438
Return an array of zeros with the same shape and type as a given array.
1421
1439
1422
1440
For full documentation refer to :obj:`numpy.zeros_like`.
1423
1441
1424
1442
Limitations
1425
1443
-----------
1426
- Parameter ``order`` is supported only with default value ``"C"``.
1444
+ Parameters ``x1`` is supported only as :class:`dpnp.dpnp_array`.
1445
+ Parameter ``order`` is supported with values ``"C"`` or ``"F"``.
1427
1446
Parameter ``subok`` is supported only with default value ``False``.
1447
+ Otherwise the function will be executed sequentially on CPU.
1428
1448
1429
1449
See Also
1430
1450
--------
@@ -1442,19 +1462,22 @@ def zeros_like(x1, dtype=None, order='C', subok=False, shape=None):
1442
1462
>>> [i for i in np.zeros_like(x)]
1443
1463
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
1444
1464
1445
- """
1446
-
1447
- x1_desc = dpnp .get_dpnp_descriptor (x1 , copy_when_nondefault_queue = False )
1448
- if x1_desc :
1449
- if order not in ('C' , 'c' , None ):
1450
- pass
1451
- elif subok is not False :
1452
- pass
1453
- else :
1454
- _shape = shape if shape is not None else x1_desc .shape
1455
- _dtype = dtype if dtype is not None else x1_desc .dtype
1456
- result = dpnp_zeros_like (_shape , _dtype ).get_pyobj ()
1457
-
1458
- return result
1465
+ """
1466
+ if not isinstance (x1 , dpnp .ndarray ):
1467
+ pass
1468
+ elif order not in ('C' , 'c' , 'F' , 'f' , None ):
1469
+ pass
1470
+ elif subok is not False :
1471
+ pass
1472
+ else :
1473
+ _shape = x1 .shape if shape is None else shape
1474
+ _dtype = x1 .dtype if dtype is None else dtype
1475
+ _usm_type = x1 .usm_type if usm_type is None else usm_type
1476
+ _sycl_queue = dpnp .get_normalized_queue_device (x1 , sycl_queue = sycl_queue , device = device )
1477
+ return dpnp_container .zeros (_shape ,
1478
+ dtype = _dtype ,
1479
+ order = order ,
1480
+ usm_type = _usm_type ,
1481
+ sycl_queue = _sycl_queue )
1459
1482
1460
1483
return call_origin (numpy .zeros_like , x1 , dtype , order , subok , shape )
0 commit comments