Skip to content

Commit 9209351

Browse files
authored
Add support of NumPy 1.24 (#1276)
* Set minimum required versions & fix debug building * Add support of numpy 1.24
1 parent 12e7bd5 commit 9209351

22 files changed

+85
-102
lines changed

conda-recipe/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ requirements:
88
host:
99
- python
1010
- setuptools
11-
- numpy >=1.19,<1.23a0
11+
- numpy >=1.19,<1.25a0
1212
- cython
1313
- cmake >=3.19
1414
- dpctl >=0.13

dpnp/backend/include/dpnp_iface_fptr.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2022, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without
@@ -391,7 +391,7 @@ enum class DPNPFuncType : size_t
391391
DPNP_FT_DOUBLE, /**< analog of numpy.float32 or double */
392392
DPNP_FT_CMPLX64, /**< analog of numpy.complex64 or std::complex<float> */
393393
DPNP_FT_CMPLX128, /**< analog of numpy.complex128 or std::complex<double> */
394-
DPNP_FT_BOOL /**< analog of numpy.bool or numpy.bool_ or bool */
394+
DPNP_FT_BOOL /**< analog of numpy.bool_ or bool */
395395
};
396396

397397
/**

dpnp/dparray.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# cython: language_level=3
22
# -*- coding: utf-8 -*-
33
# *****************************************************************************
4-
# Copyright (c) 2016-2022, Intel Corporation
4+
# Copyright (c) 2016-2023, Intel Corporation
55
# All rights reserved.
66
#
77
# Redistribution and use in source and binary forms, with or without
@@ -462,7 +462,7 @@ cdef class dparray:
462462
return ( < long * > self._dparray_data)[lin_idx]
463463
elif self.dtype == numpy.int32:
464464
return ( < int * > self._dparray_data)[lin_idx]
465-
elif self.dtype == numpy.bool:
465+
elif self.dtype == numpy.bool_:
466466
return ( < cpp_bool * > self._dparray_data)[lin_idx]
467467
elif self.dtype == numpy.complex128:
468468
return ( < double complex * > self._dparray_data)[lin_idx]
@@ -489,7 +489,7 @@ cdef class dparray:
489489
( < long * > self._dparray_data)[lin_idx] = <long > value
490490
elif self.dtype == numpy.int32:
491491
( < int * > self._dparray_data)[lin_idx] = <int > value
492-
elif self.dtype == numpy.bool:
492+
elif self.dtype == numpy.bool_:
493493
( < cpp_bool * > self._dparray_data)[lin_idx] = < cpp_bool > value
494494
elif self.dtype == numpy.complex64:
495495
( < float complex * > self._dparray_data)[lin_idx] = <float complex > value
@@ -876,7 +876,7 @@ cdef class dparray:
876876

877877
"""
878878
879-
if not numpy.issubsctype(self.dtype, numpy.complex):
879+
if not numpy.issubsctype(self.dtype, numpy.complex_):
880880
return self
881881
else:
882882
return conjugate(self)
@@ -889,7 +889,7 @@ cdef class dparray:
889889

890890
"""
891891
892-
if not numpy.issubsctype(self.dtype, numpy.complex):
892+
if not numpy.issubsctype(self.dtype, numpy.complex_):
893893
return self
894894
else:
895895
return conjugate(self)

dpnp/dpnp_algo/dpnp_algo.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ cdef dpnp_DPNPFuncType_to_dtype(size_t type):
276276
elif type == <size_t > DPNP_FT_CMPLX128:
277277
return numpy.complex128
278278
elif type == <size_t > DPNP_FT_BOOL:
279-
return numpy.bool
279+
return numpy.bool_
280280
else:
281281
utils.checker_throw_type_error("dpnp_DPNPFuncType_to_dtype", type)
282282

dpnp/dpnp_algo/dpnp_algo_arraycreation.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# cython: language_level=3
22
# -*- coding: utf-8 -*-
33
# *****************************************************************************
4-
# Copyright (c) 2016-2022, Intel Corporation
4+
# Copyright (c) 2016-2023, Intel Corporation
55
# All rights reserved.
66
#
77
# Redistribution and use in source and binary forms, with or without
@@ -434,7 +434,7 @@ cpdef utils.dpnp_descriptor dpnp_trace(utils.dpnp_descriptor arr, offset=0, axis
434434
return result
435435

436436

437-
cpdef utils.dpnp_descriptor dpnp_tri(N, M=None, k=0, dtype=numpy.float):
437+
cpdef utils.dpnp_descriptor dpnp_tri(N, M=None, k=0, dtype=dpnp.float):
438438
if M is None:
439439
M = N
440440

dpnp/dpnp_array.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
# *****************************************************************************
3-
# Copyright (c) 2016-2022, Intel Corporation
3+
# Copyright (c) 2016-2023, Intel Corporation
44
# All rights reserved.
55
#
66
# Redistribution and use in source and binary forms, with or without
@@ -493,7 +493,7 @@ def conj(self):
493493
494494
"""
495495

496-
if not numpy.issubsctype(self.dtype, numpy.complex):
496+
if not numpy.issubsctype(self.dtype, numpy.complex_):
497497
return self
498498
else:
499499
return dpnp.conjugate(self)
@@ -506,7 +506,7 @@ def conjugate(self):
506506
507507
"""
508508

509-
if not numpy.issubsctype(self.dtype, numpy.complex):
509+
if not numpy.issubsctype(self.dtype, numpy.complex_):
510510
return self
511511
else:
512512
return dpnp.conjugate(self)

dpnp/dpnp_iface_arraycreation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# distutils: language = c++
33
# -*- coding: utf-8 -*-
44
# *****************************************************************************
5-
# Copyright (c) 2016-2022, Intel Corporation
5+
# Copyright (c) 2016-2023, Intel Corporation
66
# All rights reserved.
77
#
88
# Redistribution and use in source and binary forms, with or without
@@ -1280,7 +1280,7 @@ def trace(x1, offset=0, axis1=0, axis2=1, dtype=None, out=None):
12801280
return call_origin(numpy.trace, x1, offset, axis1, axis2, dtype, out)
12811281

12821282

1283-
def tri(N, M=None, k=0, dtype=numpy.float, **kwargs):
1283+
def tri(N, M=None, k=0, dtype=dpnp.float, **kwargs):
12841284
"""
12851285
An array with ones at and below the given diagonal and zeros elsewhere.
12861286
@@ -1315,7 +1315,7 @@ def tri(N, M=None, k=0, dtype=numpy.float, **kwargs):
13151315
elif not isinstance(k, int):
13161316
pass
13171317
else:
1318-
if dtype is numpy.float:
1318+
if dtype is dpnp.float:
13191319
sycl_queue = dpnp.get_normalized_queue_device(sycl_queue=None, device=None)
13201320
dtype = map_dtype_to_device(dpnp.float64, sycl_queue.sycl_device)
13211321
return dpnp_tri(N, M, k, dtype).get_pyobj()

dpnp/dpnp_iface_mathematical.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# distutils: language = c++
33
# -*- coding: utf-8 -*-
44
# *****************************************************************************
5-
# Copyright (c) 2016-2022, Intel Corporation
5+
# Copyright (c) 2016-2023, Intel Corporation
66
# All rights reserved.
77
#
88
# Redistribution and use in source and binary forms, with or without
@@ -1545,11 +1545,11 @@ def subtract(x1, x2, dtype=None, out=None, where=True, **kwargs):
15451545
pass
15461546
elif x1_desc and x1_desc.ndim == 0:
15471547
pass
1548-
elif x1_desc and x1_desc.dtype == numpy.bool:
1548+
elif x1_desc and x1_desc.dtype == dpnp.bool:
15491549
pass
15501550
elif x2_desc and x2_desc.ndim == 0:
15511551
pass
1552-
elif x2_desc and x2_desc.dtype == numpy.bool:
1552+
elif x2_desc and x2_desc.dtype == dpnp.bool:
15531553
pass
15541554
elif dtype is not None:
15551555
pass

dpnp/dpnp_iface_statistics.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# distutils: language = c++
33
# -*- coding: utf-8 -*-
44
# *****************************************************************************
5-
# Copyright (c) 2016-2020, Intel Corporation
5+
# Copyright (c) 2016-2023, Intel Corporation
66
# All rights reserved.
77
#
88
# Redistribution and use in source and binary forms, with or without
@@ -299,7 +299,7 @@ def cov(x1, y=None, rowvar=True, bias=False, ddof=None, fweights=None, aweights=
299299
return call_origin(numpy.cov, x1, y, rowvar, bias, ddof, fweights, aweights)
300300

301301

302-
def histogram(a, bins=10, range=None, normed=None, weights=None, density=None):
302+
def histogram(a, bins=10, range=None, density=None, weights=None):
303303
"""
304304
Compute the histogram of a dataset.
305305
For full documentation refer to :obj:`numpy.histogram`.
@@ -323,7 +323,7 @@ def histogram(a, bins=10, range=None, normed=None, weights=None, density=None):
323323
1.0
324324
"""
325325

326-
return call_origin(numpy.histogram, a=a, bins=bins, range=range, normed=normed, weights=weights, density=density)
326+
return call_origin(numpy.histogram, a=a, bins=bins, range=range, density=density, weights=weights)
327327

328328

329329
def max(x1, axis=None, out=None, keepdims=False, initial=None, where=True):

dpnp/dpnp_iface_types.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# distutils: language = c++
33
# -*- coding: utf-8 -*-
44
# *****************************************************************************
5-
# Copyright (c) 2016-2020, Intel Corporation
5+
# Copyright (c) 2016-2023, Intel Corporation
66
# All rights reserved.
77
#
88
# Redistribution and use in source and binary forms, with or without
@@ -59,19 +59,19 @@
5959
"void"
6060
]
6161

62-
bool = numpy.bool
62+
bool = numpy.bool_
6363
bool_ = numpy.bool_
6464
complex128 = numpy.complex128
6565
complex64 = numpy.complex64
6666
dtype = numpy.dtype
6767
float16 = numpy.float16
6868
float32 = numpy.float32
6969
float64 = numpy.float64
70-
float = numpy.float
70+
float = numpy.float_
7171
int32 = numpy.int32
7272
int64 = numpy.int64
7373
integer = numpy.integer
74-
int = numpy.int
74+
int = numpy.int_
7575
longcomplex = numpy.longcomplex
7676

7777

0 commit comments

Comments
 (0)