tidy3d.plugins.autograd.functions.pad

Contents

tidy3d.plugins.autograd.functions.pad#

class pad[source]#

Bases:

Pad an array along specified axes with a given mode and padding width.

Parameters:
  • array (np.ndarray) – The input array to pad.

  • pad_width (Union[int, Tuple[int, int]]) – The number of values padded to the edges of each axis. If an integer is provided, it is used for both the left and right sides. If a tuple is provided, it specifies the padding for the left and right sides respectively.

  • mode (PaddingType = "constant") – The padding mode to use.

  • axis (Union[int, Iterable[int], None] = None) – The axis or axes along which to pad. If None, padding is applied to all axes.

  • constant_value (float = 0.0) – The value to set the padded values for β€œconstant” mode.

Returns:

The padded array.

Return type:

np.ndarray

Raises:
  • ValueError – If the padding width has more than two elements or if padding is negative.

  • IndexError – If an axis is out of range for the array dimensions.

Inherited Common Usage