Pad - 13 vs 18#

Next section compares an older to a newer version of the same operator after both definition are converted into markdown text. Green means an addition to the newer version, red means a deletion. Anything else is unchanged.

Files changed (1) hide show
  1. Pad13 → Pad18 +6 -17
Pad13 → Pad18 RENAMED
@@ -1 +1 @@
1
1
  Given a tensor containing the data to be padded (data), a tensor containing the number of start and end pad values for axis (pads), (optionally) a mode, and (optionally) constant_value,
2
2
  a padded tensor (output) is generated.
3
3
  The three supported modes are (similar to corresponding modes supported by numpy.pad):
4
4
  1) constant(default) - pads with a given constant value as specified by constant_value (which defaults to 0, empty string, or False)
5
5
  2) reflect - pads with the reflection of the vector mirrored on the first and last values of the vector along each axis
6
6
  3) edge - pads with the edge values of array
7
7
  Example 1 (constant mode):
8
8
  Insert 0 pads to the beginning of the second dimension.
9
9
  data =
10
10
  [
11
11
  [1.0, 1.2],
12
12
  [2.3, 3.4],
13
13
  [4.5, 5.7],
14
14
  ]
15
15
  pads = [0, 2, 0, 0]
16
16
  mode = 'constant'
17
17
  constant_value = 0.0
18
18
  output =
19
19
  [
20
20
  [0.0, 0.0, 1.0, 1.2],
21
21
  [0.0, 0.0, 2.3, 3.4],
22
22
  [0.0, 0.0, 4.5, 5.7],
23
23
  ]
24
24
  Example 2 (reflect mode):
25
25
  data =
26
26
  [
27
27
  [1.0, 1.2],
28
28
  [2.3, 3.4],
29
29
  [4.5, 5.7],
30
30
  ]
31
31
  pads = [0, 2, 0, 0]
32
32
  mode = 'reflect'
33
33
  output =
34
34
  [
35
35
  [1.0, 1.2, 1.0, 1.2],
36
36
  [2.3, 3.4, 2.3, 3.4],
37
37
  [4.5, 5.7, 4.5, 5.7],
38
38
  ]
39
39
  Example 3 (edge mode):
40
40
  data =
41
41
  [
42
42
  [1.0, 1.2],
43
43
  [2.3, 3.4],
44
44
  [4.5, 5.7],
45
45
  ]
46
46
  pads = [0, 2, 0, 0]
47
47
  mode = 'edge'
48
48
  output =
49
49
  [
50
50
  [1.0, 1.0, 1.0, 1.2],
51
51
  [2.3, 2.3, 2.3, 3.4],
52
52
  [4.5, 4.5, 4.5, 5.7],
53
53
  ]
54
54
  **Attributes**
55
55
  * **mode**:
56
56
  Supported modes: constant(default), reflect, edge
57
57
  **Inputs**
58
- Between 2 and 4 inputs.
58
+ Between 2 and 3 inputs.
59
59
  * **data** (heterogeneous) - **T**:
60
60
  Input tensor.
61
61
  * **pads** (heterogeneous) - **tensor(int64)**:
62
62
  Tensor of integers indicating the number of padding elements to add
63
63
  or remove (if negative) at the beginning and end of each axis. For
64
64
  2D input tensor, it is the number of pixels. pads should be a 1D
65
+ tensor of shape [2 * input_rank]. pads format should be:
66
+ [x1_begin, x2_begin,...,x1_end, x2_end,...], where xi_begin is the
67
+ number of pad values added at the beginning of axis i and xi_end,
65
- tensor of shape [2 * num_axes] where num_axes refers to the number
66
- of elements in the axes input or the input rank if axes are not
67
- provided explicitly. pads format should be: [x1_begin, x2_begin,
68
- ..., x1_end, x2_end,...], where xi_begin is the number of pad values
69
- added at the beginning of axis axes[i] and xi_end, the number of
70
- pad values added at the end of axis axes[i].
68
+ the number of pad values added at the end of axis i.
71
69
  * **constant_value** (optional, heterogeneous) - **T**:
72
70
  (Optional) A scalar value to be used if the mode chosen is
73
71
  constant (by default it is 0, empty string or False).
74
- * **axes** (optional, heterogeneous) - **Tind**:
75
- 1-D tensor of axes that pads apply to. Negative value means
76
- counting dimensions from the back. Accepted range is [-r, r-1] where
77
- r = rank(data). Behavior is undefined if an axis is repeated. If not
78
- provided, all axes are assumed ([0, 1, ..., input_rank-1]).
79
72
  **Outputs**
80
73
  * **output** (heterogeneous) - **T**:
81
74
  Tensor after padding.
82
75
  **Type Constraints**
83
76
  * **T** in (
84
77
  tensor(bfloat16),
85
78
  tensor(bool),
86
79
  tensor(complex128),
87
80
  tensor(complex64),
88
81
  tensor(double),
89
82
  tensor(float),
90
83
  tensor(float16),
91
84
  tensor(int16),
92
85
  tensor(int32),
93
86
  tensor(int64),
94
87
  tensor(int8),
95
88
  tensor(string),
96
89
  tensor(uint16),
97
90
  tensor(uint32),
98
91
  tensor(uint64),
99
92
  tensor(uint8)
100
93
  ):
101
- Constrain input and output types to all tensor types.
94
+ Constrain input and output types to all tensor types.- * **Tind** in (
102
- tensor(int32),
103
- tensor(int64)
104
- ):
105
- Constrain indices to integer types