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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Also, that release drops support for Python 3.9, making Python 3.10 the minimum

* Dropped support for Python 3.9 [#2626](https://github.com/IntelPython/dpnp/pull/2626)
* Removed the obsolete interface from DPNP to Numba JIT [#2647](https://github.com/IntelPython/dpnp/pull/2647)
* Removed the `newshape` parameter from `dpnp.reshape`, which has been deprecated since dpnp 0.17.0. Pass it positionally or use `shape=` on newer versions [#2670](https://github.com/IntelPython/dpnp/pull/2670)

### Fixed

Expand Down
24 changes: 2 additions & 22 deletions dpnp/dpnp_iface_manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3013,7 +3013,7 @@ def require(a, dtype=None, requirements=None, *, like=None):
return arr


def reshape(a, /, shape=None, order="C", *, newshape=None, copy=None):
def reshape(a, /, shape=None, order="C", *, copy=None):
"""
Gives a new shape to an array without changing its data.

Expand Down Expand Up @@ -3045,10 +3045,6 @@ def reshape(a, /, shape=None, order="C", *, newshape=None, copy=None):
Fortran *contiguous* in memory, C-like order otherwise.

Default: ``"C"``.
newshape : int or tuple of ints
Replaced by `shape` argument. Retained for backward compatibility.

Default: ``None``.
copy : {None, bool}, optional
If ``True``, then the array data is copied. If ``None``, a copy will
only be made if it's required by ``order``. For ``False`` it raises
Expand Down Expand Up @@ -3117,27 +3113,11 @@ def reshape(a, /, shape=None, order="C", *, newshape=None, copy=None):

"""

if newshape is None and shape is None:
if shape is None:
raise TypeError(
"reshape() missing 1 required positional argument: 'shape'"
)

if newshape is not None:
if shape is not None:
raise TypeError(
"You cannot specify 'newshape' and 'shape' arguments "
"at the same time."
)
# Deprecated in dpnp 0.17.0
warnings.warn(
"`newshape` keyword argument is deprecated, "
"use `shape=...` or pass shape positionally instead. "
"(deprecated in dpnp 0.17.0)",
DeprecationWarning,
stacklevel=2,
)
shape = newshape

if order is None:
order = "C"
elif order in "aA":
Expand Down
15 changes: 0 additions & 15 deletions dpnp/tests/test_manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1124,21 +1124,6 @@ def test_copy(self):


class TestReshape:
def test_error(self):
ia = dpnp.arange(10)
assert_raises(TypeError, dpnp.reshape, ia)
assert_raises(
TypeError, dpnp.reshape, ia, shape=(2, 5), newshape=(2, 5)
)

@pytest.mark.filterwarnings("ignore::DeprecationWarning")
def test_newshape(self):
a = numpy.arange(10)
ia = dpnp.array(a)
expected = numpy.reshape(a, (2, 5))
result = dpnp.reshape(ia, newshape=(2, 5))
assert_array_equal(result, expected)

@pytest.mark.parametrize("order", [None, "C", "F", "A"])
def test_order(self, order):
a = numpy.arange(10)
Expand Down
Loading