Skip to content

Commit 195b893

Browse files
Extend ._tensor_impl with copy functions (#2774)
This PR extends `_tensor_impl` in `dpctl_ext.tensor` with the copy functions (`_copy_usm_ndarray_for_reshape` , `_copy_numpy_ndarray_into_usm_ndarray`. `_copy_usm_ndarray_for_roll_1d`, `_copy_usm_ndarray_for_roll_nd`) It also adds `asnumpy(), astype(), copy(), from_numpy(), to_numpy(), roll(), and reshape()` to `dpctl_ext.tensor` and updates the corresponding dpnp functions to use these implementations internally
1 parent b00d064 commit 195b893

26 files changed

+2351
-86
lines changed

dpctl_ext/tensor/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ set(_tensor_impl_sources
4848
# ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/accumulators.cpp
4949
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_and_cast_usm_to_usm.cpp
5050
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_as_contig.cpp
51-
# ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.cpp
52-
# ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_for_reshape.cpp
53-
# ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_for_roll.cpp
51+
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.cpp
52+
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_for_reshape.cpp
53+
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_for_roll.cpp
5454
# ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/linear_sequences.cpp
5555
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/integer_advanced_indexing.cpp
5656
# ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/boolean_advanced_indexing.cpp

dpctl_ext/tensor/__init__.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@
2727
# *****************************************************************************
2828

2929

30+
from dpctl_ext.tensor._copy_utils import (
31+
asnumpy,
32+
astype,
33+
copy,
34+
from_numpy,
35+
to_numpy,
36+
)
3037
from dpctl_ext.tensor._ctors import (
3138
full,
3239
tril,
@@ -36,11 +43,22 @@
3643
put,
3744
take,
3845
)
46+
from dpctl_ext.tensor._manipulation_functions import (
47+
roll,
48+
)
49+
from dpctl_ext.tensor._reshape import reshape
3950

4051
__all__ = [
52+
"asnumpy",
53+
"astype",
54+
"copy",
55+
"from_numpy",
4156
"full",
4257
"put",
58+
"reshape",
59+
"roll",
4360
"take",
61+
"to_numpy",
4462
"tril",
4563
"triu",
4664
]

0 commit comments

Comments
 (0)