ivy.constant_pad(x: ivy.NativeArray, pad_width: List[Tuple[int]], value: numbers.Number = 0, f: Optional[ivy.Framework] = None) → ivy.NativeArray[source]

Pads an array with a constant value.

  • 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.

  • value (float or int, default zero) – The constant value to pad the array with.

  • 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