Pad - 1 vs 11#

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. Pad1 → Pad11 +22 -90
Pad1 → Pad11 RENAMED
@@ -1 +1 @@
1
+ Given data tensor, paddings, mode, and value.
2
+ Example:
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
- a padded tensor (output) is generated.
3
-
4
- The three supported modes are (similar to corresponding modes supported by numpy.pad):
5
-
6
- 1) constant(default) - pads with a given constant value as specified by constant_value (which defaults to 0)
7
-
8
- 2) reflect - pads with the reflection of the vector mirrored on the first and last values of the vector along each axis
9
-
10
- 3) edge - pads with the edge values of array
11
-
12
- Example 1 (constant mode):
13
- Insert 0 pads to the beginning of the second dimension.
3
+ Insert 0 paddings to the beginning of the second dimension.
14
-
15
- data =
4
+ data = [
16
- [
17
5
  [1.0, 1.2],
18
6
  [2.3, 3.4],
19
7
  [4.5, 5.7],
20
8
  ]
21
-
22
- pads = [0, 2, 0, 0]
9
+ paddings = [0, 0, 2, 0]
23
-
24
- mode = 'constant'
25
-
26
- constant_value = 0.0
27
-
28
- output =
10
+ output = [
29
- [
11
+ [
30
- [0.0, 0.0, 1.0, 1.2],
12
+ [0.0, 0.0, 1.0, 1.2],
31
- [0.0, 0.0, 2.3, 3.4],
13
+ [0.0, 0.0, 2.3, 3.4],
32
- [0.0, 0.0, 4.5, 5.7],
14
+ [0.0, 0.0, 4.5, 5.7],
15
+ ],
33
- ]
34
-
35
- Example 2 (reflect mode):
36
- data =
37
- [
38
- [1.0, 1.2],
39
- [2.3, 3.4],
40
- [4.5, 5.7],
41
- ]
42
-
43
- pads = [0, 2, 0, 0]
44
-
45
- mode = 'reflect'
46
-
47
- output =
48
- [
49
- [1.0, 1.2, 1.0, 1.2],
50
- [2.3, 3.4, 2.3, 3.4],
51
- [4.5, 5.7, 4.5, 5.7],
52
- ]
53
-
54
- Example 3 (edge mode):
55
- data =
56
- [
57
- [1.0, 1.2],
58
- [2.3, 3.4],
59
- [4.5, 5.7],
60
- ]
61
-
62
- pads = [0, 2, 0, 0]
63
-
64
- mode = 'edge'
65
-
66
- output =
67
- [
68
- [1.0, 1.0, 1.0, 1.2],
69
- [2.3, 2.3, 2.3, 3.4],
70
- [4.5, 4.5, 4.5, 5.7],
71
16
  ]
72
17
  **Attributes**
73
18
  * **mode**:
74
- Supported modes: constant(default), reflect, edge
19
+ Three modes: constant(default), reflect, edge
20
+ * **paddings** (required):
21
+ List of integers indicate the padding element count at the beginning
22
+ and end of each axis, for 2D it is the number of pixel. paddings
23
+ rank should be double of the input's rank. paddings format should
24
+ be as follow [x1_begin, x2_begin...x1_end, x2_end,...], where
25
+ xi_begin the number of pixels added at the beginning of axis i and
26
+ xi_end, the number of pixels added at the end of axis i.
27
+ * **value**:
28
+ One float, indicates the value to be filled, default is 0
75
29
  **Inputs**
76
- Between 2 and 3 inputs.
77
-
78
30
  * **data** (heterogeneous) - **T**:
79
31
  Input tensor.
80
- * **pads** (heterogeneous) - **tensor(int64)**:
81
- Tensor of integers indicating the number of padding elements to add
82
- or remove (if negative) at the beginning and end of each axis. For
83
- 2D input tensor, it is the number of pixels. pads should be a 1D
84
- tensor of shape [2 * input_rank]. pads format should be:
85
- [x1_begin, x2_begin,...,x1_end, x2_end,...], where xi_begin is the
86
- number of pad values added at the beginning of axis i and xi_end,
87
- the number of pad values added at the end of axis i.
88
- * **constant_value** (optional, heterogeneous) - **T**:
89
- (Optional) A scalar value to be used if the mode chosen is
90
- constant (by default it is 0).
91
32
  **Outputs**
92
33
  * **output** (heterogeneous) - **T**:
93
34
  Tensor after padding.
94
35
  **Type Constraints**
95
36
  * **T** in (
96
37
  tensor(double),
97
38
  tensor(float),
98
- tensor(float16),
39
+ tensor(float16)
99
- tensor(int16),
100
- tensor(int32),
101
- tensor(int64),
102
- tensor(int8),
103
- tensor(uint16),
104
- tensor(uint32),
105
- tensor(uint64),
106
- tensor(uint8)
107
40
  ):
108
- Constrain input and output to only numeric types.+ Constrain input and output types to float tensors.