pad(a: array, pad_with: int | Tuple[int] | Tuple[int, int] | List[Tuple[int, int]], constant_values: scalar | array = 0, *, stream: None | Stream | Device = None) array#

Pad an array with a constant value

  • a (array) – Input array.

  • pad_width (int, tuple(int), tuple(int, int) or list(tuple(int, int))) – Number of padded values to add to the edges of each axis:((before_1, after_1), (before_2, after_2), ..., (before_N, after_N)). If a single pair of integers is passed then (before_i, after_i) are all the same. If a single integer or tuple with a single integer is passed then all axes are extended by the same number on each side.

  • constant_value (array or scalar, optional) – Optional constant value to pad the edges of the array with.


The padded array.

Return type: