@@ -2504,14 +2504,17 @@ def pad(array, pad_width, mode="constant", **kwargs):
25042504 ----------
25052505 array : {dpnp.ndarray, usm_ndarray}
25062506 The array of rank ``N`` to pad.
2507- pad_width : {sequence, array_like, int}
2507+ pad_width : {sequence, array_like, int, dict }
25082508 Number of values padded to the edges of each axis.
25092509 ``((before_1, after_1), ... (before_N, after_N))`` unique pad widths
25102510 for each axis.
25112511 ``(before, after)`` or ``((before, after),)`` yields same before
25122512 and after pad for each axis.
25132513 ``(pad,)`` or ``int`` is a shortcut for ``before = after = pad`` width
25142514 for all axes.
2515+ If a dictionary, each key is an axis and its corresponding value is an
2516+ integer or a pair of integers describing the padding ``(before, after)``
2517+ or ``pad`` width for that axis.
25152518 mode : {str, function}, optional
25162519 One of the following string values or a user supplied function.
25172520
@@ -2694,6 +2697,26 @@ def pad(array, pad_width, mode="constant", **kwargs):
26942697 [100, 100, 100, 100, 100, 100, 100],
26952698 [100, 100, 100, 100, 100, 100, 100]])
26962699
2700+ >>> a = np.arange(1, 7).reshape(2, 3)
2701+ >>> np.pad(a, {1: (1, 2)})
2702+ array([[0, 1, 2, 3, 0, 0],
2703+ [0, 4, 5, 6, 0, 0]])
2704+ >>> np.pad(a, {-1: 2})
2705+ array([[0, 0, 1, 2, 3, 0, 0],
2706+ [0, 0, 4, 5, 6, 0, 0]])
2707+ >>> np.pad(a, {0: (3, 0)})
2708+ array([[0, 0, 0],
2709+ [0, 0, 0],
2710+ [0, 0, 0],
2711+ [1, 2, 3],
2712+ [4, 5, 6]])
2713+ >>> np.pad(a, {0: (3, 0), 1: 2})
2714+ array([[0, 0, 0, 0, 0, 0, 0],
2715+ [0, 0, 0, 0, 0, 0, 0],
2716+ [0, 0, 0, 0, 0, 0, 0],
2717+ [0, 0, 1, 2, 3, 0, 0],
2718+ [0, 0, 4, 5, 6, 0, 0]])
2719+
26972720 """
26982721
26992722 dpnp .check_supported_arrays_type (array )
0 commit comments