MaxPool - 1 vs 10¶
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 → MaxPool10 +30 -4
MaxPool1 → MaxPool10
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
|
-
output_spatial_shape[i] = floor((input_spatial_shape[i] + pad_shape[i] - kernel_spatial_shape[i]) / strides_spatial_shape[i] + 1)
|
6
|
+
output_spatial_shape[i] = floor((input_spatial_shape[i] + pad_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1)) / strides_spatial_shape[i] + 1)
|
7
|
+
|
8
|
+
or
|
9
|
+
|
10
|
+
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)
|
11
|
+
|
12
|
+
if ceil_mode is enabled
|
13
|
+
|
7
14
|
* pad_shape[i] is sum of pads along axis i
|
8
15
|
auto_pad is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following:
|
9
|
-
VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - kernel_spatial_shape[i] + 1) / strides_spatial_shape[i])
|
16
|
+
VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) + 1) / strides_spatial_shape[i])
|
10
17
|
SAME_UPPER or SAME_LOWER: output_spatial_shape[i] = ceil(input_spatial_shape[i] / strides_spatial_shape[i])
|
11
18
|
And pad shape will be following if SAME_UPPER or SAME_LOWER:
|
12
|
-
pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] + kernel_spatial_shape[i] - input_spatial_shape[i]
|
19
|
+
pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] + ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) - input_spatial_shape[i]
|
13
20
|
The output of each pooling window is maximum number of elements exclude pad.
|
14
21
|
### Attributes
|
15
22
|
* **auto_pad - STRING** (default is 'NOTSET'):
|
16
23
|
auto_pad must be either NOTSET, SAME_UPPER, SAME_LOWER or VALID. Where default value is NOTSET, which means explicit padding is used. SAME_UPPER or SAME_LOWER mean pad the input so that the output spatial size match the input.In case of odd number add the extra padding at the end for SAME_UPPER and at the beginning for SAME_LOWER. VALID mean no padding.
|
24
|
+
* **ceil_mode - INT** (default is '0'):
|
25
|
+
|
26
|
+
Whether to use ceil or floor (default) to compute the output shape.
|
27
|
+
|
28
|
+
* **dilations - INTS** :
|
29
|
+
|
30
|
+
Dilation value along each spatial axis of filter.
|
31
|
+
|
17
32
|
* **kernel_shape - INTS** (required) :
|
18
33
|
The size of the kernel along each axis.
|
19
34
|
* **pads - INTS** :
|
20
35
|
Padding for the beginning and ending along each spatial axis, it can take any value greater than or equal to 0. The value represent the number of pixels added to the beginning and end part of the corresponding axis. pads format should be as follow [x1_begin, x2_begin...x1_end, x2_end,...], where xi_begin the number of pixels added at the beginning of axis i and xi_end, the number of pixels added at the end of axis i. This attribute cannot be used simultaneously with auto_pad attribute. If not present, the padding defaults to 0 along start and end of each spatial axis.
|
36
|
+
|
37
|
+
* **storage_order - INT** (default is '0'):
|
38
|
+
|
39
|
+
The storage order of the tensor. 0 is row major, and 1 is column major.
|
21
40
|
* **strides - INTS** :
|
22
41
|
Stride along each spatial axis.
|
23
42
|
### Inputs
|
24
43
|
- **X** (heterogeneous) - **T**:
|
25
44
|
Input data tensor from the previous operator; dimensions for image case are (N x C x H x W), where N is the batch size, C is the number of channels, and H and W are the height and the width of the data. For non image case, the dimensions are in the form of (N x C x D1 x D2 ... Dn), where N is the batch size. Optionally, if dimension denotation is in effect, the operation expects the input data tensor to arrive with the dimension denotation of [DATA_BATCH, DATA_CHANNEL, DATA_FEATURE, DATA_FEATURE ...].
|
26
45
|
### Outputs
|
46
|
+
Between 1 and 2 outputs.
|
47
|
+
|
27
48
|
- **Y** (heterogeneous) - **T**:
|
28
49
|
Output data tensor from average or max pooling across the input tensor. Dimensions will vary based on various kernel, stride, and pad sizes. Floor value of the dimension is used
|
50
|
+
- **Indices** (optional, heterogeneous) - **I**:
|
51
|
+
|
52
|
+
Indices tensor from max pooling across the input tensor. The dimensions of indices are the same as output tensor. The values in indices of are the indices of the selected values during pooling. The indices are computed as flatten 1-D tensor, and the indices do not consider padding. So the values in indices are in [0, N x C x D1 x ... x Dn).
|
29
53
|
### Type Constraints
|
30
54
|
* **T** in ( tensor(double), tensor(float), tensor(float16) ):
|
55
|
+
* **I** in ( tensor(int64) ):
|
56
|
+
|
31
|
-
Constrain
|
57
|
+
Constrain index tensor to int64
|