{ } Raw JSON

bundles / scipy latest / scipy / _lib / array_api_extra / _delegation / pad

function

scipy._lib.array_api_extra._delegation:pad

source: /scipy/_lib/array_api_extra/_delegation.py :575

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 : array

Input array.

pad_width : int or tuple of ints or sequence of pairs of ints

Pad 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 of x. A single tuple, (before, after), is equivalent to a list of x.ndim copies of this tuple.

mode : str, optional

Only "constant" mode is currently supported, which pads with the value passed to constant_values.

constant_values : python scalar, optional

Use this value to pad the input. Default is zero.

xp : array_namespace, optional

The standard-compatible namespace for x. Default: infer.

Returns

: array

The input array, padded with pad_width elements equal to constant_values.

Aliases

  • scipy.differentiate.xpx.pad