@@ -3129,9 +3129,9 @@ def resize(a, new_shape):
31293129 Returns
31303130 -------
31313131 out : dpnp.ndarray
3132- The new array is formed from the data in the old array, repeated
3133- if necessary to fill out the required number of elements. The
3134- data are repeated iterating over the array in C-order.
3132+ The new array is formed from the data in the old array, repeated if
3133+ necessary to fill out the required number of elements. The data are
3134+ repeated iterating over the array in C-order.
31353135
31363136 See Also
31373137 --------
@@ -3146,8 +3146,10 @@ def resize(a, new_shape):
31463146 be used. In most other cases either indexing (to reduce the size) or
31473147 padding (to increase the size) may be a more appropriate solution.
31483148
3149- Warning: This functionality does **not** consider axes separately,
3150- i.e. it does not apply interpolation/extrapolation.
3149+ Warning
3150+ -------
3151+ This functionality does **not** consider axes separately, i.e. it does not
3152+ apply interpolation/extrapolation.
31513153 It fills the return array with the required number of elements, iterating
31523154 over `a` in C-order, disregarding axes (and cycling back from the start if
31533155 the new shape is larger). This functionality is therefore not suitable to
@@ -3187,7 +3189,8 @@ def resize(a, new_shape):
31873189 # First case must zero fill. The second would have repeats == 0.
31883190 return dpnp .zeros_like (a , shape = new_shape )
31893191
3190- repeats = - (- new_size // a_size ) # ceil division
3192+ # ceiling division without negating new_size
3193+ repeats = (new_size + a_size - 1 ) // a_size
31913194 a = dpnp .concatenate ((dpnp .ravel (a ),) * repeats )[:new_size ]
31923195
31933196 return a .reshape (new_shape )
0 commit comments