bundles / scipy 1.17.1 / scipy / _lib / array_api_extra / _delegation / pad
function
scipy._lib.array_api_extra._delegation:pad
Signature
def pad ( x : Array , pad_width : int | tuple[int, int] | Sequence[tuple[int, int]] , mode : Literal['constant'] = constant , * , constant_values : complex = 0 , xp : ModuleType | None = None ) → Array Summary
Pad the input array.
Parameters
x: arrayInput array.
pad_width: int or tuple of ints or sequence of pairs of intsPad the input array with this many elements from each side. If a sequence of tuples,
[(before_0, after_0), ... (before_N, after_N)], each pair applies to the corresponding axis ofx. A single tuple,(before, after), is equivalent to a list ofx.ndimcopies of this tuple.mode: str, optionalOnly "constant" mode is currently supported, which pads with the value passed to
constant_values.constant_values: python scalar, optionalUse this value to pad the input. Default is zero.
xp: array_namespace, optionalThe standard-compatible namespace for
x. Default: infer.
Returns
: arrayThe input array, padded with
pad_widthelements equal toconstant_values.
Aliases
-
scipy.differentiate.xpx.pad