MaxPool - 1 vs 12#
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.
- MaxPool1 → MaxPool12 +10 -44
MaxPool1 → MaxPool12
RENAMED
@@ -1 +1 @@
|
|
1
1
|
MaxPool consumes an input tensor X and applies max pooling across
|
2
2
|
the tensor according to kernel sizes, stride sizes, and pad lengths.
|
3
3
|
max pooling consisting of computing the max on all values of a
|
4
4
|
subset of the input tensor according to the kernel size and downsampling the
|
5
5
|
data into the output tensor Y for further processing. The output spatial shape will be following:
|
6
6
|
::
|
7
|
-
output_spatial_shape[i] = floor((input_spatial_shape[i] + pad_shape[i] -
|
7
|
+
output_spatial_shape[i] = floor((input_spatial_shape[i] + pad_shape[i] - kernel_spatial_shape[i]) / strides_spatial_shape[i] + 1)
|
8
|
-
|
9
|
-
or
|
10
|
-
::
|
11
|
-
|
12
|
-
output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1)) / strides_spatial_shape[i] + 1)
|
13
|
-
|
14
|
-
if ceil_mode is enabled
|
15
|
-
|
16
|
-
::
|
17
8
|
* pad_shape[i] is sum of pads along axis i
|
18
9
|
auto_pad is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following:
|
19
10
|
::
|
20
|
-
VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] -
|
11
|
+
VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - kernel_spatial_shape[i] + 1) / strides_spatial_shape[i])
|
21
12
|
SAME_UPPER or SAME_LOWER: output_spatial_shape[i] = ceil(input_spatial_shape[i] / strides_spatial_shape[i])
|
22
13
|
And pad shape will be following if SAME_UPPER or SAME_LOWER:
|
23
14
|
::
|
24
|
-
pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] +
|
15
|
+
pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] + kernel_spatial_shape[i] - input_spatial_shape[i]
|
25
16
|
The output of each pooling window is maximum number of elements exclude pad.
|
26
17
|
**Attributes**
|
27
18
|
* **auto_pad**:
|
28
19
|
auto_pad must be either NOTSET, SAME_UPPER, SAME_LOWER or VALID.
|
29
20
|
Where default value is NOTSET, which means explicit padding is used.
|
30
|
-
SAME_UPPER or SAME_LOWER mean pad the input so that
|
21
|
+
SAME_UPPER or SAME_LOWER mean pad the input so that the output
|
22
|
+
spatial size match the input.In case of odd number add the extra
|
23
|
+
padding at the end for SAME_UPPER and at the beginning for
|
24
|
+
SAME_LOWER. VALID mean no padding.
|
31
|
-
= ceil(input_shape[i] / strides[i]) for each axis i. The padding
|
32
|
-
is split between the two sides equally or almost equally (depending
|
33
|
-
on whether it is even or odd). In case the padding is an odd number,
|
34
|
-
the extra padding is added at the end for SAME_UPPER and at the
|
35
|
-
beginning for SAME_LOWER.
|
36
|
-
* **ceil_mode**:
|
37
|
-
Whether to use ceil or floor (default) to compute the output shape.
|
38
|
-
* **dilations**:
|
39
|
-
Dilation value along each spatial axis of filter. If not present,
|
40
|
-
the dilation defaults to 1 along each spatial axis.
|
41
25
|
* **kernel_shape** (required):
|
42
26
|
The size of the kernel along each axis.
|
43
27
|
* **pads**:
|
44
28
|
Padding for the beginning and ending along each spatial axis, it can
|
45
29
|
take any value greater than or equal to 0. The value represent the
|
46
30
|
number of pixels added to the beginning and end part of the
|
47
31
|
corresponding axis. pads format should be as follow [x1_begin,
|
48
32
|
x2_begin...x1_end, x2_end,...], where xi_begin the number of pixels
|
49
33
|
added at the beginning of axis i and xi_end, the number of pixels
|
50
34
|
added at the end of axis i. This attribute cannot be used
|
51
35
|
simultaneously with auto_pad attribute. If not present, the padding
|
52
36
|
defaults to 0 along start and end of each spatial axis.
|
53
|
-
* **storage_order**:
|
54
|
-
The storage order of the tensor. 0 is row major, and 1 is column
|
55
|
-
major.
|
56
37
|
* **strides**:
|
57
|
-
Stride along each spatial axis. If not present, the stride defaults
|
58
|
-
|
38
|
+
Stride along each spatial axis.
|
59
39
|
**Inputs**
|
60
40
|
* **X** (heterogeneous) - **T**:
|
61
41
|
Input data tensor from the previous operator; dimensions for image
|
62
42
|
case are (N x C x H x W), where N is the batch size, C is the number
|
63
43
|
of channels, and H and W are the height and the width of the data.
|
64
44
|
For non image case, the dimensions are in the form of (N x C x D1 x
|
65
45
|
D2 ... Dn), where N is the batch size. Optionally, if dimension
|
66
46
|
denotation is in effect, the operation expects the input data tensor
|
67
47
|
to arrive with the dimension denotation of [DATA_BATCH,
|
68
48
|
DATA_CHANNEL, DATA_FEATURE, DATA_FEATURE ...].
|
69
49
|
**Outputs**
|
70
|
-
Between 1 and 2 outputs.
|
71
|
-
|
72
50
|
* **Y** (heterogeneous) - **T**:
|
73
51
|
Output data tensor from average or max pooling across the input
|
74
52
|
tensor. Dimensions will vary based on various kernel, stride, and
|
75
53
|
pad sizes. Floor value of the dimension is used
|
76
|
-
* **Indices** (optional, heterogeneous) - **I**:
|
77
|
-
Indices tensor from max pooling across the input tensor. The
|
78
|
-
dimensions of indices are the same as output tensor. The values in
|
79
|
-
indices of are the indices of the selected values during pooling.
|
80
|
-
The indices are computed as flatten 1-D tensor, and the indices do
|
81
|
-
not consider padding. So the values in indices are in [0, N x C x D1
|
82
|
-
x ... x Dn).
|
83
54
|
**Type Constraints**
|
84
55
|
* **T** in (
|
85
56
|
tensor(double),
|
86
57
|
tensor(float),
|
87
|
-
tensor(float16)
|
58
|
+
tensor(float16)
|
88
|
-
tensor(int8),
|
89
|
-
tensor(uint8)
|
90
59
|
):
|
91
|
-
Constrain input and output types to float
|
60
|
+
Constrain input and output types to float tensors.- * **I** in (
|
92
|
-
tensor(int64)
|
93
|
-
):
|
94
|
-
Constrain index tensor to int64
|