chainer.functions.pad

chainer.functions.pad(x, pad_width, mode, **keywords)[source]

Pad an input variable.

Parameters:
  • x (chainer.Variable or :class:numpy.ndarray or cupy.ndarray) – Input data.
  • pad_width (int or array-like) – Number of values padded to the edges of each axis.
  • mode (str) – Specifies how the function fills the periphery of the array. The mode is passed to numpy.pad() or cupy.pad(). If it is 'constant', the input is padded by a constant value specified by constant_values.
  • constant_values (int or array-like) – Constant values to fill the periphery in the 'constant' mode.
Returns:

Output variable.

Return type:

Variable