Skip to content

Commit f718f2b

Browse files
authored
Merge branch 'master' into dpnp_einsum
2 parents edc498d + 37c5fe5 commit f718f2b

36 files changed

+5881
-8428
lines changed

.github/workflows/build-sphinx.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ jobs:
146146
# The step is only used to build docs while pushing a PR to "master"
147147
- name: Deploy docs
148148
if: env.GH_EVENT_PUSH_UPSTREAM
149-
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
149+
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
150150
with:
151151
github_token: ${{ secrets.GITHUB_TOKEN }}
152152
publish_dir: ${{ env.PUBLISH_DIR }}
@@ -159,7 +159,7 @@ jobs:
159159
# The step is only used to build docs while pushing to PR branch
160160
- name: Publish pull-request docs
161161
if: env.GH_EVENT_OPEN_PR_UPSTREAM
162-
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
162+
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
163163
with:
164164
github_token: ${{ secrets.GITHUB_TOKEN }}
165165
publish_dir: ${{ env.PUBLISH_DIR }}

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ repos:
9494
"--disable=redefined-builtin",
9595
"--disable=unused-wildcard-import"
9696
]
97-
files: '^dpnp/dpnp_iface(|_arraycreation|_counting|_indexing|_libmath|_linearalgebra|_manipulation|_nanfunctions|_searching|_sorting|_statistics|_types).py$'
97+
files: '^dpnp/dpnp_iface.*'

doc/conf.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
# full list see the documentation:
77
# http://www.sphinx-doc.org/en/master/config
88

9+
from sphinx.ext.autodoc import FunctionDocumenter
10+
11+
from dpnp.dpnp_algo.dpnp_elementwise_common import DPNPBinaryFunc, DPNPUnaryFunc
12+
913
try:
1014
import comparison_generator
1115
except ImportError:
@@ -188,7 +192,17 @@
188192

189193
# -- Extension configuration -------------------------------------------------
190194

195+
191196
# -- Options for todo extension ----------------------------------------------
197+
def _can_document_member(member, *args, **kwargs):
198+
if isinstance(member, (DPNPBinaryFunc, DPNPUnaryFunc)):
199+
return True
200+
return orig(member, *args, **kwargs)
201+
202+
203+
documenter = FunctionDocumenter
204+
orig = documenter.can_document_member
205+
documenter.can_document_member = _can_document_member
192206

193207
autosummary_generate = True
194208

doc/reference/math.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,17 @@ Sums, products, differences
6666

6767
dpnp.prod
6868
dpnp.sum
69+
dpnp.nanprod
70+
dpnp.nansum
6971
dpnp.cumprod
7072
dpnp.cumsum
7173
dpnp.nancumprod
7274
dpnp.nancumsum
73-
dpnp.nansum
74-
dpnp.nanprod
75-
dpnp.cross
7675
dpnp.diff
7776
dpnp.ediff1d
7877
dpnp.gradient
7978
dpnp.trapz
79+
dpnp.cross
8080

8181

8282
Exponents and logarithms

dpnp/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,4 @@ add_subdirectory(backend/extensions/sycl_ext)
6464
add_subdirectory(dpnp_algo)
6565
add_subdirectory(dpnp_utils)
6666
add_subdirectory(fft)
67-
add_subdirectory(linalg)
6867
add_subdirectory(random)

dpnp/backend/include/dpnp_iface_fptr.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ enum class DPNPFuncName : size_t
108108
DPNP_FN_CUMPROD_EXT, /**< Used in numpy.cumprod() impl, requires extra
109109
parameters */
110110
DPNP_FN_CUMSUM, /**< Used in numpy.cumsum() impl */
111-
DPNP_FN_CUMSUM_EXT, /**< Used in numpy.cumsum() impl, requires extra
112-
parameters */
113111
DPNP_FN_DEGREES, /**< Used in numpy.degrees() impl */
114112
DPNP_FN_DEGREES_EXT, /**< Used in numpy.degrees() impl, requires extra
115113
parameters */
@@ -128,11 +126,7 @@ enum class DPNPFuncName : size_t
128126
DPNP_FN_EDIFF1D_EXT, /**< Used in numpy.ediff1d() impl, requires extra
129127
parameters */
130128
DPNP_FN_EIG, /**< Used in numpy.linalg.eig() impl */
131-
DPNP_FN_EIG_EXT, /**< Used in numpy.linalg.eig() impl, requires extra
132-
parameters */
133129
DPNP_FN_EIGVALS, /**< Used in numpy.linalg.eigvals() impl */
134-
DPNP_FN_EIGVALS_EXT, /**< Used in numpy.linalg.eigvals() impl, requires
135-
extra parameters */
136130
DPNP_FN_ERF, /**< Used in scipy.special.erf impl */
137131
DPNP_FN_ERF_EXT, /**< Used in scipy.special.erf impl, requires extra
138132
parameters */

dpnp/backend/kernels/dpnp_krnl_common.cpp

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -630,15 +630,6 @@ template <typename _DataType, typename _ResultType>
630630
void (*dpnp_eig_default_c)(const void *, void *, void *, size_t) =
631631
dpnp_eig_c<_DataType, _ResultType>;
632632

633-
template <typename _DataType, typename _ResultType>
634-
DPCTLSyclEventRef (*dpnp_eig_ext_c)(DPCTLSyclQueueRef,
635-
const void *,
636-
void *,
637-
void *,
638-
size_t,
639-
const DPCTLEventVectorRef) =
640-
dpnp_eig_c<_DataType, _ResultType>;
641-
642633
template <typename _DataType, typename _ResultType>
643634
DPCTLSyclEventRef dpnp_eigvals_c(DPCTLSyclQueueRef q_ref,
644635
const void *array_in,
@@ -724,14 +715,6 @@ void (*dpnp_eigvals_default_c)(const void *,
724715
void *,
725716
size_t) = dpnp_eigvals_c<_DataType, _ResultType>;
726717

727-
template <typename _DataType, typename _ResultType>
728-
DPCTLSyclEventRef (*dpnp_eigvals_ext_c)(DPCTLSyclQueueRef,
729-
const void *,
730-
void *,
731-
size_t,
732-
const DPCTLEventVectorRef) =
733-
dpnp_eigvals_c<_DataType, _ResultType>;
734-
735718
template <typename _DataType>
736719
class dpnp_initval_c_kernel;
737720

@@ -1083,27 +1066,6 @@ void func_map_init_linalg(func_map_t &fmap)
10831066
fmap[DPNPFuncName::DPNP_FN_EIG][eft_DBL][eft_DBL] = {
10841067
eft_DBL, (void *)dpnp_eig_default_c<double, double>};
10851068

1086-
fmap[DPNPFuncName::DPNP_FN_EIG_EXT][eft_INT][eft_INT] = {
1087-
get_default_floating_type(),
1088-
(void *)dpnp_eig_ext_c<
1089-
int32_t, func_type_map_t::find_type<get_default_floating_type()>>,
1090-
get_default_floating_type<std::false_type>(),
1091-
(void *)dpnp_eig_ext_c<
1092-
int32_t, func_type_map_t::find_type<
1093-
get_default_floating_type<std::false_type>()>>};
1094-
fmap[DPNPFuncName::DPNP_FN_EIG_EXT][eft_LNG][eft_LNG] = {
1095-
get_default_floating_type(),
1096-
(void *)dpnp_eig_ext_c<
1097-
int64_t, func_type_map_t::find_type<get_default_floating_type()>>,
1098-
get_default_floating_type<std::false_type>(),
1099-
(void *)dpnp_eig_ext_c<
1100-
int64_t, func_type_map_t::find_type<
1101-
get_default_floating_type<std::false_type>()>>};
1102-
fmap[DPNPFuncName::DPNP_FN_EIG_EXT][eft_FLT][eft_FLT] = {
1103-
eft_FLT, (void *)dpnp_eig_ext_c<float, float>};
1104-
fmap[DPNPFuncName::DPNP_FN_EIG_EXT][eft_DBL][eft_DBL] = {
1105-
eft_DBL, (void *)dpnp_eig_ext_c<double, double>};
1106-
11071069
fmap[DPNPFuncName::DPNP_FN_EIGVALS][eft_INT][eft_INT] = {
11081070
eft_DBL, (void *)dpnp_eigvals_default_c<int32_t, double>};
11091071
fmap[DPNPFuncName::DPNP_FN_EIGVALS][eft_LNG][eft_LNG] = {
@@ -1113,27 +1075,6 @@ void func_map_init_linalg(func_map_t &fmap)
11131075
fmap[DPNPFuncName::DPNP_FN_EIGVALS][eft_DBL][eft_DBL] = {
11141076
eft_DBL, (void *)dpnp_eigvals_default_c<double, double>};
11151077

1116-
fmap[DPNPFuncName::DPNP_FN_EIGVALS_EXT][eft_INT][eft_INT] = {
1117-
get_default_floating_type(),
1118-
(void *)dpnp_eigvals_ext_c<
1119-
int32_t, func_type_map_t::find_type<get_default_floating_type()>>,
1120-
get_default_floating_type<std::false_type>(),
1121-
(void *)dpnp_eigvals_ext_c<
1122-
int32_t, func_type_map_t::find_type<
1123-
get_default_floating_type<std::false_type>()>>};
1124-
fmap[DPNPFuncName::DPNP_FN_EIGVALS_EXT][eft_LNG][eft_LNG] = {
1125-
get_default_floating_type(),
1126-
(void *)dpnp_eigvals_ext_c<
1127-
int64_t, func_type_map_t::find_type<get_default_floating_type()>>,
1128-
get_default_floating_type<std::false_type>(),
1129-
(void *)dpnp_eigvals_ext_c<
1130-
int64_t, func_type_map_t::find_type<
1131-
get_default_floating_type<std::false_type>()>>};
1132-
fmap[DPNPFuncName::DPNP_FN_EIGVALS_EXT][eft_FLT][eft_FLT] = {
1133-
eft_FLT, (void *)dpnp_eigvals_ext_c<float, float>};
1134-
fmap[DPNPFuncName::DPNP_FN_EIGVALS_EXT][eft_DBL][eft_DBL] = {
1135-
eft_DBL, (void *)dpnp_eigvals_ext_c<double, double>};
1136-
11371078
fmap[DPNPFuncName::DPNP_FN_INITVAL][eft_BLN][eft_BLN] = {
11381079
eft_BLN, (void *)dpnp_initval_default_c<bool>};
11391080
fmap[DPNPFuncName::DPNP_FN_INITVAL][eft_INT][eft_INT] = {

dpnp/backend/kernels/dpnp_krnl_mathematical.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -425,14 +425,6 @@ template <typename _DataType_input, typename _DataType_output>
425425
void (*dpnp_cumsum_default_c)(void *, void *, size_t) =
426426
dpnp_cumsum_c<_DataType_input, _DataType_output>;
427427

428-
template <typename _DataType_input, typename _DataType_output>
429-
DPCTLSyclEventRef (*dpnp_cumsum_ext_c)(DPCTLSyclQueueRef,
430-
void *,
431-
void *,
432-
size_t,
433-
const DPCTLEventVectorRef) =
434-
dpnp_cumsum_c<_DataType_input, _DataType_output>;
435-
436428
template <typename _KernelNameSpecialization1,
437429
typename _KernelNameSpecialization2>
438430
class dpnp_ediff1d_c_kernel;
@@ -1179,15 +1171,6 @@ void func_map_init_mathematical(func_map_t &fmap)
11791171
fmap[DPNPFuncName::DPNP_FN_CUMSUM][eft_DBL][eft_DBL] = {
11801172
eft_DBL, (void *)dpnp_cumsum_default_c<double, double>};
11811173

1182-
fmap[DPNPFuncName::DPNP_FN_CUMSUM_EXT][eft_INT][eft_INT] = {
1183-
eft_LNG, (void *)dpnp_cumsum_ext_c<int32_t, int64_t>};
1184-
fmap[DPNPFuncName::DPNP_FN_CUMSUM_EXT][eft_LNG][eft_LNG] = {
1185-
eft_LNG, (void *)dpnp_cumsum_ext_c<int64_t, int64_t>};
1186-
fmap[DPNPFuncName::DPNP_FN_CUMSUM_EXT][eft_FLT][eft_FLT] = {
1187-
eft_FLT, (void *)dpnp_cumsum_ext_c<float, float>};
1188-
fmap[DPNPFuncName::DPNP_FN_CUMSUM_EXT][eft_DBL][eft_DBL] = {
1189-
eft_DBL, (void *)dpnp_cumsum_ext_c<double, double>};
1190-
11911174
fmap[DPNPFuncName::DPNP_FN_EDIFF1D][eft_INT][eft_INT] = {
11921175
eft_LNG, (void *)dpnp_ediff1d_default_c<int32_t, int64_t>};
11931176
fmap[DPNPFuncName::DPNP_FN_EDIFF1D][eft_LNG][eft_LNG] = {

dpnp/dpnp_algo/dpnp_algo.pxd

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,10 @@ cdef extern from "dpnp_iface_fptr.hpp" namespace "DPNPFuncName": # need this na
3838
DPNP_FN_COPY_EXT
3939
DPNP_FN_CORRELATE_EXT
4040
DPNP_FN_CUMPROD_EXT
41-
DPNP_FN_CUMSUM_EXT
4241
DPNP_FN_DEGREES_EXT
4342
DPNP_FN_DIAG_INDICES_EXT
4443
DPNP_FN_DIAGONAL_EXT
4544
DPNP_FN_EDIFF1D_EXT
46-
DPNP_FN_EIG_EXT
47-
DPNP_FN_EIGVALS_EXT
4845
DPNP_FN_ERF_EXT
4946
DPNP_FN_FABS_EXT
5047
DPNP_FN_FFT_FFT_EXT

dpnp/dpnp_algo/dpnp_algo_mathematical.pxi

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ and the rest of the library
3737

3838
__all__ += [
3939
"dpnp_cumprod",
40-
"dpnp_cumsum",
4140
"dpnp_ediff1d",
4241
"dpnp_fabs",
4342
"dpnp_fmod",
@@ -46,7 +45,6 @@ __all__ += [
4645
"dpnp_fmin",
4746
"dpnp_modf",
4847
"dpnp_nancumprod",
49-
"dpnp_nancumsum",
5048
"dpnp_trapz",
5149
]
5250

@@ -71,18 +69,6 @@ cpdef utils.dpnp_descriptor dpnp_cumprod(utils.dpnp_descriptor x1):
7169
return call_fptr_1in_1out(DPNP_FN_CUMPROD_EXT, x1, (x1.size,))
7270

7371

74-
cpdef utils.dpnp_descriptor dpnp_cumsum(utils.dpnp_descriptor x1):
75-
# instead of x1.shape, (x1.size, ) is passed to the function
76-
# due to the following:
77-
# >>> import numpy
78-
# >>> a = numpy.array([[1, 2], [2, 3]])
79-
# >>> res = numpy.cumsum(a)
80-
# >>> res.shape
81-
# (4,)
82-
83-
return call_fptr_1in_1out(DPNP_FN_CUMSUM_EXT, x1, (x1.size,))
84-
85-
8672
cpdef utils.dpnp_descriptor dpnp_ediff1d(utils.dpnp_descriptor x1):
8773

8874
if x1.size <= 1:
@@ -254,19 +240,6 @@ cpdef utils.dpnp_descriptor dpnp_nancumprod(utils.dpnp_descriptor x1):
254240
return dpnp_cumprod(x1_desc)
255241

256242

257-
cpdef utils.dpnp_descriptor dpnp_nancumsum(utils.dpnp_descriptor x1):
258-
cur_x1 = x1.get_pyobj().copy()
259-
260-
cur_x1_flatiter = cur_x1.flat
261-
262-
for i in range(cur_x1.size):
263-
if dpnp.isnan(cur_x1_flatiter[i]):
264-
cur_x1_flatiter[i] = 0
265-
266-
x1_desc = dpnp.get_dpnp_descriptor(cur_x1, copy_when_nondefault_queue=False)
267-
return dpnp_cumsum(x1_desc)
268-
269-
270243
cpdef utils.dpnp_descriptor dpnp_trapz(utils.dpnp_descriptor y1, utils.dpnp_descriptor x1, double dx):
271244

272245
cdef DPNPFuncType param1_type = dpnp_dtype_to_DPNPFuncType(y1.dtype)

0 commit comments

Comments
 (0)