Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 5 additions & 5 deletions dpnp/dpnp_algo/dpnp_algo_bitwise.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,23 @@ __all__ += [


cpdef dparray dpnp_bitwise_and(object x1_obj, object x2_obj, object dtype=None, dparray out=None, object where=True):
return call_fptr_2in_1out(DPNP_FN_BITWISE_AND, x1_obj, x2_obj, dtype=dtype, out=out, where=where)
return call_fptr_2in_1out_new(DPNP_FN_BITWISE_AND, x1_obj, x2_obj, dtype=dtype, out=out, where=where)


cpdef dparray dpnp_bitwise_or(object x1_obj, object x2_obj, object dtype=None, dparray out=None, object where=True):
return call_fptr_2in_1out(DPNP_FN_BITWISE_OR, x1_obj, x2_obj, dtype=dtype, out=out, where=where)
return call_fptr_2in_1out_new(DPNP_FN_BITWISE_OR, x1_obj, x2_obj, dtype=dtype, out=out, where=where)


cpdef dparray dpnp_bitwise_xor(object x1_obj, object x2_obj, object dtype=None, dparray out=None, object where=True):
return call_fptr_2in_1out(DPNP_FN_BITWISE_XOR, x1_obj, x2_obj, dtype=dtype, out=out, where=where)
return call_fptr_2in_1out_new(DPNP_FN_BITWISE_XOR, x1_obj, x2_obj, dtype=dtype, out=out, where=where)


cpdef dparray dpnp_invert(dparray arr):
return call_fptr_1in_1out(DPNP_FN_INVERT, arr, arr.shape)


cpdef dparray dpnp_left_shift(object x1_obj, object x2_obj, object dtype=None, dparray out=None, object where=True):
return call_fptr_2in_1out(DPNP_FN_LEFT_SHIFT, x1_obj, x2_obj, dtype=dtype, out=out, where=where)
return call_fptr_2in_1out_new(DPNP_FN_LEFT_SHIFT, x1_obj, x2_obj, dtype=dtype, out=out, where=where)

cpdef dparray dpnp_right_shift(object x1_obj, object x2_obj, object dtype=None, dparray out=None, object where=True):
return call_fptr_2in_1out(DPNP_FN_RIGHT_SHIFT, x1_obj, x2_obj, dtype=dtype, out=out, where=where)
return call_fptr_2in_1out_new(DPNP_FN_RIGHT_SHIFT, x1_obj, x2_obj, dtype=dtype, out=out, where=where)
23 changes: 13 additions & 10 deletions dpnp/dpnp_iface_bitwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,26 @@

def _check_nd_call(origin_func, dpnp_func, x1, x2, dtype=None, out=None, where=True, **kwargs):
"""Choose function to call based on input and call chosen fucntion."""
x1_is_scalar, x2_is_scalar = dpnp.isscalar(x1), dpnp.isscalar(x2)
x1_is_dparray, x2_is_dparray = isinstance(x1, dparray), isinstance(x2, dparray)

if not use_origin_backend(x1) and not kwargs:
if not x1_is_dparray and not x1_is_scalar:
x1_is_scalar = dpnp.isscalar(x1)
x2_is_scalar = dpnp.isscalar(x2)
x1_desc = dpnp.get_dpnp_descriptor(x1)
x2_desc = dpnp.get_dpnp_descriptor(x2)

if x1_desc and x2_desc and not kwargs:
if not x1_desc and not x1_is_scalar:
pass
elif not x2_is_dparray and not x2_is_scalar:
elif not x2_desc and not x2_is_scalar:
pass
elif x1_is_scalar and x2_is_scalar:
pass
elif x1_is_dparray and x1.ndim == 0:
elif x1_desc and x1_desc.ndim == 0:
pass
elif x2_is_dparray and x2.ndim == 0:
elif x2_desc and x2_desc.ndim == 0:
pass
elif x1_is_dparray and x2_is_dparray and x1.size != x2.size:
elif x1_desc and x2_desc and x1_desc.size != x2_desc.size:
pass
elif x1_is_dparray and x2_is_dparray and x1.shape != x2.shape:
elif x1_desc and x2_desc and x1_desc.shape != x2_desc.shape:
pass
elif out is not None and not isinstance(out, dparray):
pass
Expand All @@ -88,7 +91,7 @@ def _check_nd_call(origin_func, dpnp_func, x1, x2, dtype=None, out=None, where=T
elif not where:
pass
else:
return dpnp_func(x1, x2, dtype=dtype, out=out, where=where)
return dpnp_func(x1_desc, x2_desc, dtype=dtype, out=out, where=where)

return call_origin(origin_func, x1, x2, dtype=dtype, out=out, where=where, **kwargs)

Expand Down