ivy.zero_pad(x: Union[ivy.Array, ivy.NativeArray], pad_width: Iterable[Tuple[int]], f: Optional[ivy.Framework] = None) → Union[ivy.Array, ivy.NativeArray][source]

Pads an array with zeros.

  • x (array) – Input array to pad.

  • pad_width (sequence of tuples of ints) – Number of values padded to the edges of each axis. Specified as ((before_1, after_1), … (before_N, after_N)), where N is number of axes of x.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.


Padded array of rank equal to x with shape increased according to pad_width.

Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty