chainerx.reshape

chainerx.reshape(a, newshape)

Returns a reshaped array.

Parameters
  • a (ndarray) – Array to be reshaped.

  • newshape (int or tuple of ints) – The new shape of the array to return. If it is an integer, then it is treated as a tuple of length one. It should be compatible with a.size. One of the elements can be -1, which is automatically replaced with the appropriate value to make the shape compatible with a.size.

Returns

A reshaped view of a if possible, otherwise a copy.

Return type

ndarray

Note

During backpropagation, this function propagates the gradient of the output array to the input array a.

See also

numpy.reshape()