jax.numpy.resize

Contents

jax.numpy.resize#

jax.numpy.resize(a, new_shape)[source]#

Return a new array with the specified shape.

LAX-backend implementation of numpy.resize().

Original docstring below.

If the new array is larger than the original array, then the new array is filled with repeated copies of a. Note that this behavior is different from a.resize(new_shape) which fills with zeros instead of repeated copies of a.

Parameters:
  • a (array_like) – Array to be resized.

  • new_shape (int or tuple of int) – Shape of resized array.

Returns:

reshaped_array – The new array is formed from the data in the old array, repeated if necessary to fill out the required number of elements. The data are repeated iterating over the array in C-order.

Return type:

ndarray