File tree Expand file tree Collapse file tree 2 files changed +31
-5
lines changed Expand file tree Collapse file tree 2 files changed +31
-5
lines changed Original file line number Diff line number Diff line change @@ -514,7 +514,37 @@ def ndim(self):
514
514
# 'ravel',
515
515
# 'real',
516
516
# 'repeat',
517
- # 'reshape',
517
+
518
+ def reshape (self , d0 , * dn , order = b'C' ):
519
+ """
520
+ Returns an array containing the same data with a new shape.
521
+
522
+ Refer to `dpnp.reshape` for full documentation.
523
+
524
+ .. seealso::
525
+ :meth:`numpy.ndarray.reshape`
526
+
527
+ Notes
528
+ -----
529
+ Unlike the free function `dpnp.reshape`, this method on `ndarray` allows
530
+ the elements of the shape parameter to be passed in as separate arguments.
531
+ For example, ``a.reshape(10, 11)`` is equivalent to
532
+ ``a.reshape((10, 11))``.
533
+
534
+ """
535
+
536
+ if dn :
537
+ if not isinstance (d0 , int ):
538
+ msg_tmpl = "'{}' object cannot be interpreted as an integer"
539
+ raise TypeError (msg_tmpl .format (type (d0 ).__name__ ))
540
+ shape = [d0 , * dn ]
541
+ else :
542
+ shape = d0
543
+
544
+ shape_tup = dpnp .dpnp_utils ._object_to_tuple (shape )
545
+
546
+ return dpnp .reshape (self , shape_tup )
547
+
518
548
# 'resize',
519
549
# 'round',
520
550
# 'searchsorted',
Original file line number Diff line number Diff line change @@ -132,11 +132,7 @@ tests/third_party/cupy/manipulation_tests/test_basic.py::TestCopytoFromScalar_pa
132
132
tests/third_party/cupy/manipulation_tests/test_basic.py::TestCopytoFromScalar_param_32_{dst_shape=(2, 2), src=True}::test_copyto_where
133
133
tests/third_party/cupy/manipulation_tests/test_basic.py::TestCopytoFromScalar_param_33_{dst_shape=(2, 2), src=False}::test_copyto_where
134
134
tests/third_party/cupy/manipulation_tests/test_basic.py::TestCopytoFromScalar_param_34_{dst_shape=(2, 2), src=(1+1j)}::test_copyto_where
135
- tests/third_party/cupy/manipulation_tests/test_shape.py::TestReshape::test_reshape_invalid_order
136
- tests/third_party/cupy/manipulation_tests/test_shape.py::TestReshape::test_reshape_with_changed_arraysize
137
- tests/third_party/cupy/manipulation_tests/test_shape.py::TestReshape::test_reshape_with_multiple_unknown_dimensions
138
135
tests/third_party/cupy/manipulation_tests/test_shape.py::TestReshape::test_reshape_zerosize
139
- tests/third_party/cupy/manipulation_tests/test_shape.py::TestReshape::test_reshape_zerosize_invalid
140
136
tests/third_party/cupy/math_tests/test_sumprod.py::TestCumprod::test_cumprod_out_noncontiguous
141
137
tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_0_{axis=0}::test_cumsum_axis_out_noncontiguous
142
138
tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_0_{axis=0}::test_cumsum_out_noncontiguous
You can’t perform that action at this time.
0 commit comments