Pad - 2 vs 13#

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. Pad2 → Pad13 +22 -93
Pad2 → Pad13 RENAMED
@@ -1 +1 @@
1
+ Given data tensor, pads, 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, empty string, or False)
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
3
  Insert 0 pads 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
9
  pads = [0, 2, 0, 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
+ * **pads** (required):
21
+ List of integers indicating the number of padding elements to add or
22
+ remove (if negative) at the beginning and end of each axis. For 2D
23
+ it is the number of pixels. pads rank should be double of the
24
+ input's rank. pads format should be as follow [x1_begin,
25
+ x2_begin...x1_end, x2_end,...], where xi_begin the number of pixels
26
+ added at the beginning of axis i and xi_end, the number of pixels
27
+ added at the end of axis i.
28
+ * **value**:
29
+ One float, indicates the value to be filled.
75
30
  **Inputs**
76
- Between 2 and 3 inputs.
77
-
78
31
  * **data** (heterogeneous) - **T**:
79
32
  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, empty string or False).
91
33
  **Outputs**
92
34
  * **output** (heterogeneous) - **T**:
93
35
  Tensor after padding.
94
36
  **Type Constraints**
95
37
  * **T** in (
96
- tensor(bfloat16),
97
- tensor(bool),
98
- tensor(complex128),
99
- tensor(complex64),
100
38
  tensor(double),
101
39
  tensor(float),
102
- tensor(float16),
40
+ tensor(float16)
103
- tensor(int16),
104
- tensor(int32),
105
- tensor(int64),
106
- tensor(int8),
107
- tensor(string),
108
- tensor(uint16),
109
- tensor(uint32),
110
- tensor(uint64),
111
- tensor(uint8)
112
41
  ):
113
- Constrain input and output types to all tensor types.? ^^ -----
42
+ Constrain input and output types to float tensors.? +++ ^