Skip to content

Commit a59ccd1

Browse files
Merge move_elementwise_binary_impl_part_3 into finalize_functional_migration
2 parents ecbc6a3 + c3d5ad7 commit a59ccd1

65 files changed

Lines changed: 257 additions & 235 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

dpctl_ext/tensor/__init__.py

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,16 @@
2727
# *****************************************************************************
2828

2929

30-
from dpctl_ext.tensor._copy_utils import (
30+
from ._accumulation import cumulative_logsumexp, cumulative_prod, cumulative_sum
31+
from ._clip import clip
32+
from ._copy_utils import (
3133
asnumpy,
3234
astype,
3335
copy,
3436
from_numpy,
3537
to_numpy,
3638
)
37-
from dpctl_ext.tensor._ctors import (
39+
from ._ctors import (
3840
arange,
3941
asarray,
4042
empty,
@@ -51,42 +53,6 @@
5153
zeros,
5254
zeros_like,
5355
)
54-
from dpctl_ext.tensor._indexing_functions import (
55-
extract,
56-
nonzero,
57-
place,
58-
put,
59-
put_along_axis,
60-
take,
61-
take_along_axis,
62-
)
63-
from dpctl_ext.tensor._linear_algebra_functions import (
64-
matmul,
65-
matrix_transpose,
66-
tensordot,
67-
vecdot,
68-
)
69-
from dpctl_ext.tensor._manipulation_functions import (
70-
broadcast_arrays,
71-
broadcast_to,
72-
concat,
73-
expand_dims,
74-
flip,
75-
moveaxis,
76-
permute_dims,
77-
repeat,
78-
roll,
79-
squeeze,
80-
stack,
81-
swapaxes,
82-
tile,
83-
unstack,
84-
)
85-
from dpctl_ext.tensor._reshape import reshape
86-
from dpctl_ext.tensor._utility_functions import all, any, diff
87-
88-
from ._accumulation import cumulative_logsumexp, cumulative_prod, cumulative_sum
89-
from ._clip import clip
9056
from ._elementwise_funcs import (
9157
abs,
9258
acos,
@@ -130,6 +96,7 @@
13096
log1p,
13197
log2,
13298
log10,
99+
logaddexp,
133100
logical_and,
134101
logical_not,
135102
logical_or,
@@ -159,6 +126,37 @@
159126
tanh,
160127
trunc,
161128
)
129+
from ._indexing_functions import (
130+
extract,
131+
nonzero,
132+
place,
133+
put,
134+
put_along_axis,
135+
take,
136+
take_along_axis,
137+
)
138+
from ._linear_algebra_functions import (
139+
matmul,
140+
matrix_transpose,
141+
tensordot,
142+
vecdot,
143+
)
144+
from ._manipulation_functions import (
145+
broadcast_arrays,
146+
broadcast_to,
147+
concat,
148+
expand_dims,
149+
flip,
150+
moveaxis,
151+
permute_dims,
152+
repeat,
153+
roll,
154+
squeeze,
155+
stack,
156+
swapaxes,
157+
tile,
158+
unstack,
159+
)
162160
from ._reduction import (
163161
argmax,
164162
argmin,
@@ -170,6 +168,7 @@
170168
reduce_hypot,
171169
sum,
172170
)
171+
from ._reshape import reshape
173172
from ._search_functions import where
174173
from ._searchsorted import searchsorted
175174
from ._set_functions import (
@@ -183,6 +182,7 @@
183182
from ._statistical_functions import mean, std, var
184183
from ._testing import allclose
185184
from ._type_utils import can_cast, finfo, iinfo, isdtype, result_type
185+
from ._utility_functions import all, any, diff
186186

187187
__all__ = [
188188
"abs",
@@ -259,6 +259,7 @@
259259
"less_equal",
260260
"linspace",
261261
"log",
262+
"logaddexp",
262263
"logical_and",
263264
"logical_not",
264265
"logical_or",

dpctl_ext/tensor/_accumulation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@
3535
import dpctl_ext.tensor as dpt_ext
3636
import dpctl_ext.tensor._tensor_accumulation_impl as tai
3737
import dpctl_ext.tensor._tensor_impl as ti
38-
from dpctl_ext.tensor._type_utils import (
38+
39+
from ._numpy_helper import normalize_axis_index
40+
from ._type_utils import (
3941
_default_accumulation_dtype,
4042
_default_accumulation_dtype_fp_types,
4143
_to_device_supported_dtype,
4244
)
4345

44-
from ._numpy_helper import normalize_axis_index
45-
4646

4747
def _accumulate_common(
4848
x,

dpctl_ext/tensor/_clip.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@
3535
import dpctl_ext.tensor as dpt_ext
3636
import dpctl_ext.tensor._tensor_elementwise_impl as tei
3737
import dpctl_ext.tensor._tensor_impl as ti
38-
from dpctl_ext.tensor._copy_utils import (
38+
39+
from ._copy_utils import (
3940
_empty_like_orderK,
4041
_empty_like_pair_orderK,
4142
_empty_like_triple_orderK,
4243
)
43-
from dpctl_ext.tensor._manipulation_functions import _broadcast_shape_impl
44-
from dpctl_ext.tensor._type_utils import _can_cast
45-
44+
from ._manipulation_functions import _broadcast_shape_impl
4645
from ._scalar_utils import (
4746
_get_dtype,
4847
_get_queue_usm_type,
4948
_get_shape,
5049
_validate_dtype,
5150
)
5251
from ._type_utils import (
52+
_can_cast,
5353
_resolve_one_strong_one_weak_types,
5454
_resolve_one_strong_two_weak_types,
5555
)

dpctl_ext/tensor/_copy_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
# when dpnp fully migrates dpctl/tensor
4343
import dpctl_ext.tensor as dpt_ext
4444
import dpctl_ext.tensor._tensor_impl as ti
45-
from dpctl_ext.tensor._type_utils import _dtype_supported_by_device_impl
4645

4746
from ._numpy_helper import normalize_axis_index
47+
from ._type_utils import _dtype_supported_by_device_impl
4848

4949
__doc__ = (
5050
"Implementation module for copy- and cast- operations on "
@@ -299,7 +299,7 @@ def _prepare_indices_arrays(inds, q, usm_type):
299299
inds = tuple(
300300
map(
301301
lambda ind: (
302-
ind if ind.dtype == ind_dt else dpt.astype(ind, ind_dt)
302+
ind if ind.dtype == ind_dt else dpt_ext.astype(ind, ind_dt)
303303
),
304304
inds,
305305
)

dpctl_ext/tensor/_ctors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
# when dpnp fully migrates dpctl/tensor
4343
import dpctl_ext.tensor as dpt_ext
4444
import dpctl_ext.tensor._tensor_impl as ti
45-
from dpctl_ext.tensor._copy_utils import (
45+
46+
from ._copy_utils import (
4647
_empty_like_orderK,
4748
_from_numpy_empty_like_orderK,
4849
)

dpctl_ext/tensor/_reshape.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,17 @@
3131
import dpctl.tensor as dpt
3232
import dpctl.utils
3333
import numpy as np
34-
from dpctl.tensor._tensor_impl import (
35-
_copy_usm_ndarray_for_reshape,
36-
_ravel_multi_index,
37-
_unravel_index,
38-
)
3934

4035
# TODO: revert to `import dpctl.tensor...`
4136
# when dpnp fully migrates dpctl/tensor
4237
import dpctl_ext.tensor as dpt_ext
4338

39+
from ._tensor_impl import (
40+
_copy_usm_ndarray_for_reshape,
41+
_ravel_multi_index,
42+
_unravel_index,
43+
)
44+
4445
__doc__ = "Implementation module for :func:`dpctl.tensor.reshape`."
4546

4647

dpctl_ext/tensor/_search_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
# when dpnp fully migrates dpctl/tensor
3535
import dpctl_ext.tensor as dpt_ext
3636
import dpctl_ext.tensor._tensor_impl as ti
37-
from dpctl_ext.tensor._manipulation_functions import _broadcast_shape_impl
3837

3938
from ._copy_utils import _empty_like_orderK, _empty_like_triple_orderK
39+
from ._manipulation_functions import _broadcast_shape_impl
4040
from ._scalar_utils import (
4141
_get_dtype,
4242
_get_queue_usm_type,

dpctl_ext/tensor/libtensor/include/kernels/clip.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
#pragma once
3636
#include <algorithm>
3737
#include <cmath>
38-
#include <complex>
3938
#include <cstddef>
4039
#include <cstdint>
4140
#include <type_traits>
41+
#include <vector>
4242

4343
#include <sycl/sycl.hpp>
4444

dpctl_ext/tensor/libtensor/include/kernels/constructors.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@
3333
//===----------------------------------------------------------------------===//
3434

3535
#pragma once
36+
3637
#include <array>
37-
#include <complex>
3838
#include <cstddef>
39+
#include <type_traits>
3940
#include <vector>
4041

4142
#include <sycl/sycl.hpp>
@@ -130,7 +131,7 @@ sycl::event lin_space_step_impl(sycl::queue &exec_q,
130131
}
131132

132133
// Constructor to populate tensor with linear sequence defined by
133-
// start and and data
134+
// start and data
134135

135136
template <typename Ty, typename wTy>
136137
class LinearSequenceAffineFunctor
@@ -191,7 +192,7 @@ class LinearSequenceAffineFunctor
191192
*
192193
* @param exec_q Sycl queue to which kernel is submitted for execution.
193194
* @param nelems Length of the sequence.
194-
* @param start_v Stating value of the sequence.
195+
* @param start_v Starting value of the sequence.
195196
* @param end_v End-value of the sequence.
196197
* @param include_endpoint Whether the end-value is included in the sequence.
197198
* @param array_data Kernel accessible USM pointer to the start of array to be

dpctl_ext/tensor/libtensor/include/kernels/elementwise_functions/common.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,8 @@
3333
#pragma once
3434

3535
#include <algorithm>
36-
#include <cmath>
37-
#include <complex>
3836
#include <cstddef>
3937
#include <cstdint>
40-
#include <limits>
4138
#include <type_traits>
4239
#include <vector>
4340

0 commit comments

Comments
 (0)