Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions dpnp/backend/include/dpnp_iface_fptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ enum class DPNPFuncName : size_t
DPNP_FN_FILL_DIAGONAL_EXT, /**< Used in numpy.fill_diagonal() impl, requires
extra parameters */
DPNP_FN_FLATTEN, /**< Used in numpy.flatten() impl */
DPNP_FN_FLATTEN_EXT, /**< Used in numpy.flatten() impl, requires extra
parameters */
DPNP_FN_FLOOR, /**< Used in numpy.floor() impl */
DPNP_FN_FLOOR_DIVIDE, /**< Used in numpy.floor_divide() impl */
DPNP_FN_FLOOR_DIVIDE_EXT, /**< Used in numpy.floor_divide() impl, requires
Expand Down Expand Up @@ -265,8 +263,6 @@ enum class DPNPFuncName : size_t
DPNP_FN_RECIP_EXT, /**< Used in numpy.recip() impl, requires extra
parameters */
DPNP_FN_REPEAT, /**< Used in numpy.repeat() impl */
DPNP_FN_REPEAT_EXT, /**< Used in numpy.repeat() impl, requires extra
parameters */
DPNP_FN_RIGHT_SHIFT, /**< Used in numpy.right_shift() impl */
DPNP_FN_RNG_BETA, /**< Used in numpy.random.beta() impl */
DPNP_FN_RNG_BETA_EXT, /**< Used in numpy.random.beta() impl, requires extra
Expand Down
18 changes: 0 additions & 18 deletions dpnp/backend/kernels/dpnp_krnl_manipulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,6 @@ void (*dpnp_repeat_default_c)(const void *,
const size_t,
const size_t) = dpnp_repeat_c<_DataType>;

template <typename _DataType>
DPCTLSyclEventRef (*dpnp_repeat_ext_c)(DPCTLSyclQueueRef,
const void *,
void *,
const size_t,
const size_t,
const DPCTLEventVectorRef) =
dpnp_repeat_c<_DataType>;

template <typename _KernelNameSpecialization>
class dpnp_elemwise_transpose_c_kernel;

Expand Down Expand Up @@ -232,15 +223,6 @@ void func_map_init_manipulation(func_map_t &fmap)
fmap[DPNPFuncName::DPNP_FN_REPEAT][eft_DBL][eft_DBL] = {
eft_DBL, (void *)dpnp_repeat_default_c<double>};

fmap[DPNPFuncName::DPNP_FN_REPEAT_EXT][eft_INT][eft_INT] = {
eft_INT, (void *)dpnp_repeat_ext_c<int32_t>};
fmap[DPNPFuncName::DPNP_FN_REPEAT_EXT][eft_LNG][eft_LNG] = {
eft_LNG, (void *)dpnp_repeat_ext_c<int64_t>};
fmap[DPNPFuncName::DPNP_FN_REPEAT_EXT][eft_FLT][eft_FLT] = {
eft_FLT, (void *)dpnp_repeat_ext_c<float>};
fmap[DPNPFuncName::DPNP_FN_REPEAT_EXT][eft_DBL][eft_DBL] = {
eft_DBL, (void *)dpnp_repeat_ext_c<double>};

fmap[DPNPFuncName::DPNP_FN_TRANSPOSE][eft_INT][eft_INT] = {
eft_INT, (void *)dpnp_elemwise_transpose_default_c<int32_t>};
fmap[DPNPFuncName::DPNP_FN_TRANSPOSE][eft_LNG][eft_LNG] = {
Expand Down
1 change: 0 additions & 1 deletion dpnp/dpnp_algo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

set(dpnp_algo_pyx_deps
${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_linearalgebra.pxi
${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_manipulation.pxi
${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_counting.pxi
${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_statistics.pxi
${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_trigonometric.pxi
Expand Down
12 changes: 0 additions & 12 deletions dpnp/dpnp_algo/dpnp_algo.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ cdef extern from "dpnp_iface_fptr.hpp" namespace "DPNPFuncName": # need this na
DPNP_FN_FFT_RFFT_EXT
DPNP_FN_FILL_DIAGONAL
DPNP_FN_FILL_DIAGONAL_EXT
DPNP_FN_FLATTEN
DPNP_FN_FLATTEN_EXT
DPNP_FN_FMOD
DPNP_FN_FMOD_EXT
DPNP_FN_FULL
Expand Down Expand Up @@ -138,8 +136,6 @@ cdef extern from "dpnp_iface_fptr.hpp" namespace "DPNPFuncName": # need this na
DPNP_FN_RADIANS_EXT
DPNP_FN_RECIP
DPNP_FN_RECIP_EXT
DPNP_FN_REPEAT
DPNP_FN_REPEAT_EXT
DPNP_FN_RNG_BETA
DPNP_FN_RNG_BETA_EXT
DPNP_FN_RNG_BINOMIAL
Expand Down Expand Up @@ -331,8 +327,6 @@ ctypedef c_dpctl.DPCTLSyclEventRef(*dpnp_reduction_c_t)(c_dpctl.DPCTLSyclQueueRe
const long*,
const c_dpctl.DPCTLEventVectorRef)

cpdef dpnp_descriptor dpnp_flatten(dpnp_descriptor x1)


"""
Internal functions
Expand Down Expand Up @@ -367,12 +361,6 @@ cpdef dpnp_descriptor dpnp_fmax(dpnp_descriptor x1_obj, dpnp_descriptor x2_obj,
dpnp_descriptor out=*, object where=*)
cpdef dpnp_descriptor dpnp_fmin(dpnp_descriptor x1_obj, dpnp_descriptor x2_obj, object dtype=*,
dpnp_descriptor out=*, object where=*)
"""
Array manipulation routines
"""
cpdef dpnp_descriptor dpnp_repeat(dpnp_descriptor array1, repeats, axes=*)


"""
Statistics functions
"""
Expand Down
49 changes: 0 additions & 49 deletions dpnp/dpnp_algo/dpnp_algo.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import operator
import numpy

__all__ = [
"dpnp_flatten",
"dpnp_queue_initialize",
]

Expand All @@ -64,7 +63,6 @@ include "dpnp_algo_counting.pxi"
include "dpnp_algo_indexing.pxi"
include "dpnp_algo_linearalgebra.pxi"
include "dpnp_algo_logic.pxi"
include "dpnp_algo_manipulation.pxi"
include "dpnp_algo_mathematical.pxi"
include "dpnp_algo_searching.pxi"
include "dpnp_algo_sorting.pxi"
Expand All @@ -82,53 +80,6 @@ ctypedef c_dpctl.DPCTLSyclEventRef(*fptr_dpnp_flatten_t)(c_dpctl.DPCTLSyclQueueR
const c_dpctl.DPCTLEventVectorRef)


cpdef utils.dpnp_descriptor dpnp_flatten(utils.dpnp_descriptor x1):
cdef DPNPFuncType param1_type = dpnp_dtype_to_DPNPFuncType(x1.dtype)

cdef DPNPFuncData kernel_data = get_dpnp_function_ptr(DPNP_FN_FLATTEN_EXT, param1_type, param1_type)

cdef shape_type_c x1_shape = x1.shape
cdef shape_type_c x1_strides = utils.strides_to_vector(x1.strides, x1_shape)

x1_obj = x1.get_array()

# create result array with type given by FPTR data
cdef shape_type_c result_shape = (x1.size,)
cdef utils.dpnp_descriptor result = utils.create_output_descriptor(result_shape,
kernel_data.return_type,
None,
device=x1_obj.sycl_device,
usm_type=x1_obj.usm_type,
sycl_queue=x1_obj.sycl_queue)

result_sycl_queue = result.get_array().sycl_queue

cdef c_dpctl.SyclQueue q = <c_dpctl.SyclQueue> result_sycl_queue
cdef c_dpctl.DPCTLSyclQueueRef q_ref = q.get_queue_ref()

cdef shape_type_c result_strides = utils.strides_to_vector(result.strides, result_shape)

cdef fptr_dpnp_flatten_t func = <fptr_dpnp_flatten_t > kernel_data.ptr
cdef c_dpctl.DPCTLSyclEventRef event_ref = func(q_ref,
result.get_data(),
result.size,
result.ndim,
result_shape.data(),
result_strides.data(),
x1.get_data(),
x1.size,
x1.ndim,
x1_shape.data(),
x1_strides.data(),
NULL,
NULL) # dep_events_ref

with nogil: c_dpctl.DPCTLEvent_WaitAndThrow(event_ref)
c_dpctl.DPCTLEvent_Delete(event_ref)

return result


cpdef dpnp_queue_initialize():
"""
Initialize SYCL queue which will be used for any library operations.
Expand Down
80 changes: 0 additions & 80 deletions dpnp/dpnp_algo/dpnp_algo_manipulation.pxi

This file was deleted.

73 changes: 71 additions & 2 deletions dpnp/dpnp_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,47 @@ def put(self, indices, vals, /, *, axis=None, mode="wrap"):

return dpnp.put(self, indices, vals, axis=axis, mode=mode)

# 'ravel',
def ravel(self, order="C"):
"""
Return a contiguous flattened array.

For full documentation refer to :obj:`numpy.ndarray.ravel`.

Parameters
----------
order : {'C', 'F'}, optional
The elements of a are read using this index order. ``C`` means to index
the elements in row-major, C-style order, with the last axis index
changing fastest, back to the first axis index changing slowest. ``F``
means to index the elements in column-major, Fortran-style order, with
the first index changing fastest, and the last index changing slowest.
By default, ``C`` index order is used.

Returns
-------
y : dpnp_array
`y` is a contiguous 1-D array of the same subtype as a, with shape (a.size,)

See Also
--------
:obj:`dpnp.reshape` : Change the shape of an array without changing its data.

Examples
--------
>>> import dpnp as np
>>> x = np.array([[1, 2, 3], [4, 5, 6]])
>>> x.ravel()
array([1, 2, 3, 4, 5, 6])

>>> x.reshape(-1)
array([1, 2, 3, 4, 5, 6])

>>> x.ravel(order='F')
array([1, 4, 2, 5, 3, 6])

"""

return dpnp.ravel(self, order=order)

@property
def real(self):
Expand Down Expand Up @@ -1082,7 +1122,36 @@ def real(self, value):
"""
dpnp.copyto(self._array_obj.real, value)

# 'repeat',
def repeat(self, repeats, axis=None):
"""
Repeat elements of an array.

For full documentation refer to :obj:`numpy.ndarray.repeat`.

Parameters
----------
repeat : Union[int, Tuple[int, ...]]
The number of repetitions for each element.
`repeats` is broadcasted to fit the shape of the given axis.
axis : Optional[int]
The axis along which to repeat values. The `axis` is required
if input array has more than one dimension.

Returns
-------
out : dpnp_array
Array with repeated elements.

Examples
--------
>>> import dpnp as np
>>> x = np.array([3])
>>> x.repeat(4)
array([3, 3, 3, 3])

"""

return dpnp.repeat(self, repeats, axis=axis)

def reshape(self, *sh, **kwargs):
"""
Expand Down
Loading