cupy.pad¶
-
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.
- ’edge’
- Pads with the edge values of array.
- ’reflect’
- Pads with the reflection of the vector mirrored on the first and last values of the vector along each axis.
- 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
. - reflect_type – {‘even’, ‘odd’}, optional Used in ‘reflect’, and ‘symmetric’. The ‘even’ style is the default with an unaltered reflection around the edge value. For the ‘odd’ style, the extented part of the array is created by subtracting the reflected values from two times the edge value.
Returns: Padded array of rank equal to
array
with shape increased according topad_width
.Return type: See also