AveragePool - 7 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.
- AveragePool7 → AveragePool11 +31 -14
AveragePool7 → AveragePool11
RENAMED
@@ -1 +1 @@
|
|
1
1
|
AveragePool consumes an input tensor X and applies average pooling across
|
2
|
-
|
2
|
+
the tensor according to kernel sizes, stride sizes, and pad lengths.
|
3
|
-
|
3
|
+
average pooling consisting of computing the average 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
|
+
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
|
+
or
|
8
|
+
|
9
|
+
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)
|
10
|
+
|
7
|
-
|
11
|
+
if ceil_mode is enabled
|
8
|
-
|
12
|
+
* pad_shape[i] is sum of pads along axis i
|
9
|
-
VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - kernel_spatial_shape[i] + 1) / strides_spatial_shape[i])
|
10
|
-
|
13
|
+
auto_pad is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following when ceil_mode is enabled:
|
11
|
-
And pad shape will be following if SAME_UPPER or SAME_LOWER:
|
14
|
+
VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) + 1) / strides_spatial_shape[i])
|
15
|
+
SAME_UPPER or SAME_LOWER: output_spatial_shape[i] = ceil(input_spatial_shape[i] / strides_spatial_shape[i])
|
16
|
+
or when ceil_mode is disabled:
|
17
|
+
|
18
|
+
VALID: output_spatial_shape[i] = floor((input_spatial_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) + 1) / strides_spatial_shape[i])
|
19
|
+
SAME_UPPER or SAME_LOWER: output_spatial_shape[i] = floor(input_spatial_shape[i] / strides_spatial_shape[i])
|
20
|
+
|
21
|
+
|
22
|
+
And pad shape will be following if SAME_UPPER or SAME_LOWER:
|
23
|
+
|
12
|
-
|
24
|
+
pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] + ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) - input_spatial_shape[i]
|
25
|
+
|
13
|
-
|
26
|
+
The output of each pooling window is divided by the number of elements (exclude pad when attribute count_include_pad is zero).
|
14
27
|
### Attributes
|
15
28
|
* **auto_pad - STRING** (default is 'NOTSET'):
|
16
|
-
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
|
29
|
+
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 output_shape[i] = ceil(input_shape[i] / strides[i]) for each axis i. The padding is split between the two sides equally or almost equally (depending on whether it is even or odd). In case the padding is an odd number, the extra padding is added at the end for SAME_UPPER and at the beginning for SAME_LOWER.
|
30
|
+
|
31
|
+
* **ceil_mode - INT** (default is '0'):
|
32
|
+
|
33
|
+
Whether to use ceil or floor (default) to compute the output shape.
|
17
34
|
* **count_include_pad - INT** (default is '0'):
|
18
35
|
Whether include pad pixels when calculating values for the edges. Default is 0, doesn't count include pad.
|
19
36
|
* **kernel_shape - INTS** (required) :
|
20
37
|
The size of the kernel along each axis.
|
21
38
|
* **pads - INTS** :
|
22
39
|
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.
|
23
40
|
* **strides - INTS** :
|
24
|
-
Stride along each spatial axis.
|
41
|
+
Stride along each spatial axis. If not present, the stride defaults to 1 along each spatial axis.
|
25
42
|
### Inputs
|
26
43
|
- **X** (heterogeneous) - **T**:
|
27
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 ...].
|
28
45
|
### Outputs
|
29
46
|
- **Y** (heterogeneous) - **T**:
|
30
47
|
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
|
31
48
|
### Type Constraints
|
32
49
|
* **T** in ( tensor(double), tensor(float), tensor(float16) ):
|
33
50
|
Constrain input and output types to float tensors.
|