Padding¶
-
cupy.
pad
(array, pad_width, mode, **keywords)[source]¶ Returns padded array. You can specify the padded widths and values.
This function currently supports only
mode=constant
.Parameters: - array (array-like) – Input array of rank N.
- pad_width (int or array-like) – Number of values padded
to the edges of each axis.
((before_1, after_1), ... (before_N, after_N)) uniquely pad widths
for each axis.
((before, after),) yields same before and after pad for each axis.
(pad,) or int is a shortcut for before = after = pad width for all
axes.
You cannot specify
cupy.ndarray
. - mode (str) –
- ‘constant’
- Pads with a constant values.
- constant_values (int or array-like) – Used in
constant
. The values are padded for each axis. ((before_1, after_1), ... (before_N, after_N)) uniquely pad constants for each axis. ((before, after),) yields same before and after constants for each axis. (constant,) or int is a shortcut for before = after = constant for all axes. Default is 0. You cannot specifycupy.ndarray
.
Returns: Padded array of rank equal to
array
with shape increased according topad_width
.Return type: See also