constant_pad

ivy.constant_pad(x, pad_width, value=0, f=None)[source]

Pads an array with a constant value.

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

Returns

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