AveragePool - version 19#

This page documents version 19 of operator AveragePool. See AveragePool for the latest version (since version 22).

  • Domain: ai.onnx

  • Since version: 19

AveragePool consumes an input tensor X and applies average pooling across the tensor according to kernel sizes, stride sizes, and pad lengths. average pooling consisting of computing the average on all values of a subset of the input tensor according to the kernel size and downsampling the data into the output tensor Y for further processing. The output spatial shape is calculated differently depending on whether explicit padding is used, where pads is employed, or auto padding is used, where auto_pad is utilized. With explicit padding (https://pytorch.org/docs/stable/generated/torch.nn.MaxPool2d.html?highlight=maxpool#torch.nn.MaxPool2d):

output_spatial_shape[i] = floor((input_spatial_shape[i] + pad_shape[i] - dilation[i] * (kernel_shape[i] - 1) - 1) / strides_spatial_shape[i] + 1)

or

output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - dilation[i] * (kernel_shape[i] - 1) - 1) / strides_spatial_shape[i] + 1)

if ceil_mode is enabled. pad_shape[i] is the sum of pads along axis i.

auto_pad is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following when ceil_mode is enabled:

VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) + 1) / strides_spatial_shape[i])
SAME_UPPER or SAME_LOWER: output_spatial_shape[i] = ceil(input_spatial_shape[i] / strides_spatial_shape[i])

or when ceil_mode is disabled (https://www.tensorflow.org/api_docs/python/tf/keras/layers/AveragePooling2D):

VALID: output_spatial_shape[i] = floor((input_spatial_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1)) / strides_spatial_shape[i]) + 1
SAME_UPPER or SAME_LOWER: output_spatial_shape[i] = floor((input_spatial_shape[i] - 1) / strides_spatial_shape[i]) + 1

And pad shape will be following if SAME_UPPER or SAME_LOWER:

pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] + ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) - input_spatial_shape[i]

The output of each pooling window is divided by the number of elements (exclude pad when attribute count_include_pad is zero).

Inputs

  • X (T): 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 …].

Outputs

  • Y (T): 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

Type Constraints

  • T: Constrain input and output types to float tensors. Allowed types: tensor(double), tensor(float), tensor(float16).

Examples#

test_cc_averagepool_1d_default

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [2]
Inputs:
  x: shape=(1, 1, 8), dtype=float32
    [[[1., 2., 3., 4., 5., 6., 7., 8.]]]

Outputs:
  y: shape=(1, 1, 7), dtype=float32
    [[[1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5]]]

test_cc_averagepool_2d_ceil

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [3, 3]
    strides = [2, 2]
    ceil_mode = 1
Inputs:
  x: shape=(1, 1, 4, 4), dtype=float32
    [[[[ 1.,  2.,  3.,  4.],
       [ 5.,  6.,  7.,  8.],
       [ 9., 10., 11., 12.],
       [13., 14., 15., 16.]]]]

Outputs:
  y: shape=(1, 1, 2, 2), dtype=float32
    [[[[ 6. ,  7.5],
       [12. , 13.5]]]]

test_cc_averagepool_2d_ceil_last_window_starts_on_pad

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [3, 3]
    strides = [3, 3]
    pads = [1, 1, 1, 1]
    ceil_mode = 1
    count_include_pad = 1
Inputs:
  x: shape=(1, 1, 2, 2), dtype=float32
    [[[[1., 2.],
       [3., 4.]]]]

Outputs:
  y: shape=(1, 1, 1, 1), dtype=float32
    [[[[1.1111112]]]]

test_cc_averagepool_2d_default

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [2, 2]
Inputs:
  x: shape=(1, 1, 4, 4), dtype=float32
    [[[[ 1.,  2.,  3.,  4.],
       [ 5.,  6.,  7.,  8.],
       [ 9., 10., 11., 12.],
       [13., 14., 15., 16.]]]]

Outputs:
  y: shape=(1, 1, 3, 3), dtype=float32
    [[[[ 3.5,  4.5,  5.5],
       [ 7.5,  8.5,  9.5],
       [11.5, 12.5, 13.5]]]]

test_cc_averagepool_2d_dilations

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [2, 2]
    strides = [1, 1]
    dilations = [2, 2]
    ceil_mode = 1
Inputs:
  x: shape=(1, 1, 4, 4), dtype=float32
    [[[[ 1.,  2.,  3.,  4.],
       [ 5.,  6.,  7.,  8.],
       [ 9., 10., 11., 12.],
       [13., 14., 15., 16.]]]]

Outputs:
  y: shape=(1, 1, 2, 2), dtype=float32
    [[[[ 6.,  7.],
       [10., 11.]]]]

test_cc_averagepool_2d_pads

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [3, 3]
    pads = [2, 2, 2, 2]
Inputs:
  x: shape=(1, 1, 4, 4), dtype=float32
    [[[[ 1.,  2.,  3.,  4.],
       [ 5.,  6.,  7.,  8.],
       [ 9., 10., 11., 12.],
       [13., 14., 15., 16.]]]]

Outputs:
  y: shape=(1, 1, 6, 6), dtype=float32
    [[[[ 1. ,  1.5,  2. ,  3. ,  3.5,  4. ],
       [ 3. ,  3.5,  4. ,  5. ,  5.5,  6. ],
       [ 5. ,  5.5,  6. ,  7. ,  7.5,  8. ],
       [ 9. ,  9.5, 10. , 11. , 11.5, 12. ],
       [11. , 11.5, 12. , 13. , 13.5, 14. ],
       [13. , 13.5, 14. , 15. , 15.5, 16. ]]]]

test_cc_averagepool_2d_pads_count_include_pad

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [3, 3]
    pads = [1, 1, 1, 1]
    count_include_pad = 1
Inputs:
  x: shape=(1, 1, 5, 5), dtype=float32
    [[[[ 1.,  2.,  3.,  4.,  5.],
       [ 6.,  7.,  8.,  9., 10.],
       [11., 12., 13., 14., 15.],
       [16., 17., 18., 19., 20.],
       [21., 22., 23., 24., 25.]]]]

Outputs:
  y: shape=(1, 1, 5, 5), dtype=float32
    [[[[ 1.7777778,  3.       ,  3.6666667,  4.3333335,  3.1111112],
       [ 4.3333335,  7.       ,  8.       ,  9.       ,  6.3333335],
       [ 7.6666665, 12.       , 13.       , 14.       ,  9.666667 ],
       [11.       , 17.       , 18.       , 19.       , 13.       ],
       [ 8.444445 , 13.       , 13.666667 , 14.333333 ,  9.777778 ]]]]

test_cc_averagepool_2d_precomputed_pads

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [5, 5]
    pads = [2, 2, 2, 2]
Inputs:
  x: shape=(1, 1, 5, 5), dtype=float32
    [[[[ 1.,  2.,  3.,  4.,  5.],
       [ 6.,  7.,  8.,  9., 10.],
       [11., 12., 13., 14., 15.],
       [16., 17., 18., 19., 20.],
       [21., 22., 23., 24., 25.]]]]

Outputs:
  y: shape=(1, 1, 5, 5), dtype=float32
    [[[[ 7. ,  7.5,  8. ,  8.5,  9. ],
       [ 9.5, 10. , 10.5, 11. , 11.5],
       [12. , 12.5, 13. , 13.5, 14. ],
       [14.5, 15. , 15.5, 16. , 16.5],
       [17. , 17.5, 18. , 18.5, 19. ]]]]

test_cc_averagepool_2d_precomputed_pads_count_include_pad

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [5, 5]
    pads = [2, 2, 2, 2]
    count_include_pad = 1
Inputs:
  x: shape=(1, 1, 5, 5), dtype=float32
    [[[[ 1.,  2.,  3.,  4.,  5.],
       [ 6.,  7.,  8.,  9., 10.],
       [11., 12., 13., 14., 15.],
       [16., 17., 18., 19., 20.],
       [21., 22., 23., 24., 25.]]]]

Outputs:
  y: shape=(1, 1, 5, 5), dtype=float32
    [[[[ 2.52,  3.6 ,  4.8 ,  4.08,  3.24],
       [ 4.56,  6.4 ,  8.4 ,  7.04,  5.52],
       [ 7.2 , 10.  , 13.  , 10.8 ,  8.4 ],
       [ 6.96,  9.6 , 12.4 , 10.24,  7.92],
       [ 6.12,  8.4 , 10.8 ,  8.88,  6.84]]]]

test_cc_averagepool_2d_precomputed_same_upper

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [3, 3]
    strides = [2, 2]
    auto_pad = "SAME_UPPER"
Inputs:
  x: shape=(1, 1, 5, 5), dtype=float32
    [[[[ 1.,  2.,  3.,  4.,  5.],
       [ 6.,  7.,  8.,  9., 10.],
       [11., 12., 13., 14., 15.],
       [16., 17., 18., 19., 20.],
       [21., 22., 23., 24., 25.]]]]

Outputs:
  y: shape=(1, 1, 3, 3), dtype=float32
    [[[[ 4. ,  5.5,  7. ],
       [11.5, 13. , 14.5],
       [19. , 20.5, 22. ]]]]

test_cc_averagepool_2d_precomputed_strides

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [2, 2]
    strides = [2, 2]
Inputs:
  x: shape=(1, 1, 5, 5), dtype=float32
    [[[[ 1.,  2.,  3.,  4.,  5.],
       [ 6.,  7.,  8.,  9., 10.],
       [11., 12., 13., 14., 15.],
       [16., 17., 18., 19., 20.],
       [21., 22., 23., 24., 25.]]]]

Outputs:
  y: shape=(1, 1, 2, 2), dtype=float32
    [[[[ 4.,  6.],
       [14., 16.]]]]

test_cc_averagepool_2d_same_lower

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [2, 2]
    auto_pad = "SAME_LOWER"
Inputs:
  x: shape=(1, 1, 4, 4), dtype=float32
    [[[[ 1.,  2.,  3.,  4.],
       [ 5.,  6.,  7.,  8.],
       [ 9., 10., 11., 12.],
       [13., 14., 15., 16.]]]]

Outputs:
  y: shape=(1, 1, 4, 4), dtype=float32
    [[[[ 1. ,  1.5,  2.5,  3.5],
       [ 3. ,  3.5,  4.5,  5.5],
       [ 7. ,  7.5,  8.5,  9.5],
       [11. , 11.5, 12.5, 13.5]]]]

test_cc_averagepool_2d_same_upper

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [2, 2]
    auto_pad = "SAME_UPPER"
Inputs:
  x: shape=(1, 1, 4, 4), dtype=float32
    [[[[ 1.,  2.,  3.,  4.],
       [ 5.,  6.,  7.,  8.],
       [ 9., 10., 11., 12.],
       [13., 14., 15., 16.]]]]

Outputs:
  y: shape=(1, 1, 4, 4), dtype=float32
    [[[[ 3.5,  4.5,  5.5,  6. ],
       [ 7.5,  8.5,  9.5, 10. ],
       [11.5, 12.5, 13.5, 14. ],
       [13.5, 14.5, 15.5, 16. ]]]]

test_cc_averagepool_2d_strides

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [3, 3]
    strides = [2, 2]
Inputs:
  x: shape=(1, 1, 5, 5), dtype=float32
    [[[[ 1.,  2.,  3.,  4.,  5.],
       [ 6.,  7.,  8.,  9., 10.],
       [11., 12., 13., 14., 15.],
       [16., 17., 18., 19., 20.],
       [21., 22., 23., 24., 25.]]]]

Outputs:
  y: shape=(1, 1, 2, 2), dtype=float32
    [[[[ 7.,  9.],
       [17., 19.]]]]

test_cc_averagepool_3d_default

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [2, 2, 2]
Inputs:
  x: shape=(1, 1, 3, 3, 3), dtype=float32
    [[[[[ 1.,  2.,  3.],
        [ 4.,  5.,  6.],
        [ 7.,  8.,  9.]],

       [[10., 11., 12.],
        [13., 14., 15.],
        [16., 17., 18.]],

       [[19., 20., 21.],
        [22., 23., 24.],
        [25., 26., 27.]]]]]

Outputs:
  y: shape=(1, 1, 2, 2, 2), dtype=float32
    [[[[[ 7.5,  8.5],
        [10.5, 11.5]],

       [[16.5, 17.5],
        [19.5, 20.5]]]]]

test_cc_averagepool_3d_dilations_large_count_include_pad_is_0_ceil_mode_is_False

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [5, 5, 5]
    strides = [3, 3, 3]
    dilations = [2, 2, 2]
    count_include_pad = 0
    ceil_mode = 0
Inputs:
  x: shape=(1, 1, 32, 32, 32), dtype=float32
    [[[[[ 8.50300431e-01,  1.20730209e+00, -1.67355525e+00, ...,
         -1.60918462e+00,  3.06047916e-01, -5.82710445e-01],
        [-4.67289954e-01, -2.63735127e+00, -3.13882113e-01, ...,
         -1.40207028e+00,  2.48131633e-01,  1.41474092e+00],
        [-1.40531743e+00, -4.69839483e-01, -7.64128685e-01, ...,
          5.01729012e-01, -1.12608373e+00, -8.11151862e-02],
        ...,
        [ 5.06167352e-01, -6.19015574e-01, -1.88780755e-01, ...,
          4.29102868e-01,  5.03742814e-01,  6.60402238e-01],
        [ 2.60863066e-01,  9.98518527e-01,  3.07028741e-01, ...,
          9.52490449e-01, -8.62753928e-01, -1.22287467e-01],
        [ 2.51117349e-03,  5.11795461e-01, -3.20357800e-01, ...,
          2.85645843e+00,  1.98449385e+00,  4.22590464e-01]],

       [[-1.25146961e+00, -1.49601924e+00,  4.53292489e-01, ...,
          1.50562978e+00,  9.53712404e-01,  1.47527933e-01],
        [-7.81706989e-01, -3.21121663e-01, -4.39704895e-01, ...,
          1.91549063e+00, -1.53456175e+00, -4.21628892e-01],
        [-1.40300322e+00, -4.80016023e-01,  1.31841135e+00, ...,
          6.83870852e-01, -8.15410495e-01,  2.37923533e-01],
        ...,
        [-2.06336594e+00,  1.34925222e+00,  5.30328453e-01, ...,
          2.41370344e+00,  8.81595075e-01,  1.84858888e-01],
        [ 1.09629191e-01, -7.47793734e-01,  1.59168386e+00, ...,
          1.74676895e+00,  1.47476811e-02,  2.17207924e-01],
        [-6.02578223e-01,  2.00051785e+00,  5.99152327e-01, ...,
          6.46553099e-01,  2.33925477e-01, -5.15749931e-01]],

       [[ 1.48659563e+00,  9.89729285e-01,  7.69777298e-02, ...,
         -2.17333883e-01,  4.79351848e-01,  4.17035490e-01],
        [-3.34057480e-01, -6.06993437e-01, -1.68192744e-01, ...,
         -5.82712471e-01, -2.12683961e-01,  5.50045788e-01],
        [-1.13685203e+00, -1.74287364e-01,  1.21590948e+00, ...,
         -2.84650266e-01, -6.57436490e-01, -6.73575282e-01],
        ...,
        [-1.23165309e+00,  2.58959562e-01, -3.04704428e-01, ...,
          1.43104768e+00, -9.23035264e-01, -6.66225970e-01],
        [-3.05514365e-01, -5.73995411e-01, -5.73933959e-01, ...,
          3.82285953e-01, -9.66405153e-01, -1.60944772e+00],
        [-1.30592239e+00, -1.02129407e-01,  1.03067003e-01, ...,
         -1.89198041e+00, -7.76150031e-04,  1.38392353e+00]],

       ...,

       [[ 1.27364504e+00, -5.53654432e-01,  1.70140159e+00, ...,
         -1.03748548e+00,  3.62081856e-01, -7.71185219e-01],
        [ 2.44982038e-02,  1.30714726e+00, -8.60952511e-02, ...,
          8.91671538e-01,  8.35806370e-01,  1.54746819e+00],
        [-1.01716673e+00,  7.90534317e-02, -1.68321282e-01, ...,
          6.62739456e-01,  4.93642390e-01, -5.84398270e-01],
        ...,
        [ 4.97618854e-01, -3.08742166e-01,  5.48359811e-01, ...,
         -8.02698195e-01,  1.20837644e-01,  3.27181697e-01],
        [-1.33860612e+00,  1.40809584e+00, -1.58748090e+00, ...,
          4.07909006e-01, -7.83718467e-01, -3.75761464e-02],
        [-3.34292240e-02, -2.68937826e-01, -2.92234998e-02, ...,
         -2.27771282e-01, -6.89963698e-01,  1.94690913e-01]],

       [[ 1.08033843e-01,  4.14851516e-01,  5.91306627e-01, ...,
          6.27529025e-01,  6.05478525e-01, -1.08147120e+00],
        [-3.31001103e-01,  1.41650140e+00,  8.61553848e-01, ...,
         -1.71548653e+00,  1.11228800e+00, -1.10369432e+00],
        [ 6.72244370e-01,  3.39172900e-01,  4.72254932e-01, ...,
         -4.61298674e-01,  1.25110120e-01,  1.60443962e+00],
        ...,
        [-2.77277261e-01,  4.60715473e-01,  9.17327046e-01, ...,
          1.36620283e-01,  7.74140060e-01, -6.78931296e-01],
        [ 1.31727114e-01, -1.30065632e+00,  1.58735967e+00, ...,
          1.05808176e-01, -1.78082669e+00, -6.09214723e-01],
        [ 4.29296255e-01, -1.11845028e+00, -8.99960175e-02, ...,
         -7.65817523e-01,  3.79978746e-01,  9.02557448e-02]],

       [[-4.01741862e-01, -9.27063078e-02,  8.39975953e-01, ...,
          1.24751282e+00, -3.01822066e-01, -5.34276843e-01],
        [ 2.86678225e-01, -5.36440253e-01, -9.55621779e-01, ...,
          1.63153723e-01, -2.66641796e-01, -1.12668760e-01],
        [-9.71804440e-01,  5.39478779e-01, -3.23834568e-01, ...,
         -6.32149458e-01,  3.97406816e-01, -7.02832937e-02],
        ...,
        [-8.56808901e-01,  2.08146349e-01,  7.17755258e-01, ...,
         -1.67446578e+00, -1.14663744e+00,  1.14858079e+00],
        [-2.00425220e+00, -2.78254356e-02,  9.86716092e-01, ...,
          9.10550356e-01,  1.04827893e+00,  1.03470039e+00],
        [-1.11044598e+00, -1.23551950e-01, -6.95125878e-01, ...,
         -1.27523050e-01, -7.26920962e-01,  1.12385976e+00]]]]]

Outputs:
  y: shape=(1, 1, 8, 8, 8), dtype=float32
    [[[[[-2.53600236e-02, -1.77980199e-01, -9.52748507e-02, ...,
          1.37296906e-02, -5.53164333e-02,  6.85236380e-02],
        [ 1.09532088e-01,  5.44061102e-02,  1.00442261e-01, ...,
         -5.60618602e-02, -2.20600255e-02,  3.76205817e-02],
        [ 1.27212694e-02, -5.29450737e-02, -6.31223693e-02, ...,
         -8.77763629e-02, -1.41056687e-01,  5.61749302e-02],
        ...,
        [ 8.32509696e-02, -7.94642344e-02, -4.41913046e-02, ...,
         -3.90158929e-02,  2.20906869e-01,  1.46367438e-02],
        [-8.96740239e-03, -1.81069672e-01,  1.26859039e-01, ...,
          1.28138229e-01,  3.61349969e-03, -7.76018016e-03],
        [ 8.28588456e-02,  1.02851681e-01,  7.96865299e-02, ...,
          5.97868711e-02, -3.91868781e-03, -3.04665118e-02]],

       [[-3.61490138e-02, -2.16969177e-02,  6.88115060e-02, ...,
         -1.09829776e-01, -1.16738137e-02, -6.15502261e-02],
        [-2.76851635e-02,  4.75118905e-02, -9.21340734e-02, ...,
         -7.25981370e-02,  1.76403590e-03, -7.15890527e-02],
        [-8.39668363e-02, -1.07023910e-01,  1.26457572e-01, ...,
         -5.95539100e-02, -1.60892099e-01,  9.15608257e-02],
        ...,
        [ 1.24960832e-01, -5.37522845e-02,  3.90152968e-02, ...,
          1.83966920e-01, -2.50539859e-03,  1.54061437e-01],
        [-4.51038629e-02,  5.40703945e-02, -8.53776857e-02, ...,
         -1.11893855e-01, -7.36726224e-02, -8.23583174e-03],
        [-1.52572161e-02, -4.51447628e-02, -1.66535988e-01, ...,
         -2.72690728e-02,  5.62231205e-02,  1.39861017e-01]],

       [[-6.78933188e-02, -6.65688589e-02, -1.09032653e-01, ...,
          1.36554725e-02,  2.54760869e-02,  6.84703812e-02],
        [ 3.51824351e-02,  1.23498626e-01,  2.08289996e-02, ...,
          1.22116849e-01,  4.81875017e-02,  1.33338541e-01],
        [-2.24503037e-02,  3.81416321e-05, -1.59491464e-01, ...,
         -1.73771698e-02,  1.00632139e-01, -5.61353713e-02],
        ...,
        [-1.91803053e-02, -2.38807537e-02,  3.63335498e-02, ...,
         -9.59810466e-02,  9.36447531e-02,  2.28159159e-01],
        [ 1.23630213e-02,  7.88441151e-02, -1.00848615e-01, ...,
          1.30003497e-01, -1.27774388e-01, -1.53663233e-02],
        [-4.96927947e-02, -4.18961328e-03, -7.13019669e-02, ...,
          4.58220914e-02, -5.23971990e-02,  9.79342759e-02]],

       ...,

       [[-1.87206596e-01,  1.66149423e-01, -6.59042224e-02, ...,
         -5.59760481e-02,  5.39642619e-03,  7.84076303e-02],
        [-6.81607351e-02, -1.29714549e-01, -3.57849710e-02, ...,
         -2.67572328e-02, -6.01494545e-03, -1.13883853e-01],
        [-1.01373211e-01,  1.55488728e-03, -5.31778485e-02, ...,
         -2.98657529e-02, -6.78040311e-02,  3.79792601e-02],
        ...,
        [ 1.93010449e-01, -1.31991565e-01,  1.28906280e-01, ...,
         -5.58273159e-02,  3.59931663e-02,  2.92527042e-02],
        [ 1.45151913e-01, -5.01158200e-02, -7.36352652e-02, ...,
          1.25775784e-01, -5.72716445e-02,  7.88772479e-02],
        [ 1.27020881e-01, -7.26448596e-02, -4.02720040e-03, ...,
         -1.05554707e-01, -4.31276765e-03, -2.83555128e-02]],

       [[ 1.11094024e-02,  6.87166154e-02, -6.49782410e-03, ...,
         -9.42007750e-02,  2.67891809e-02, -1.06703900e-01],
        [-8.65677465e-03,  3.81513350e-02, -8.70045573e-02, ...,
          2.39633266e-02, -1.56983349e-03,  5.27461246e-02],
        [ 9.96032916e-03,  8.30266774e-02, -3.81403193e-02, ...,
         -1.71431538e-03, -7.78268576e-02, -1.23526812e-01],
        ...,
        [-1.33098051e-01,  1.01494886e-01, -1.96330562e-01, ...,
         -1.04603462e-01, -4.00561057e-02, -1.27186719e-02],
        [-1.40660061e-02,  3.27548347e-02,  5.06800339e-02, ...,
          7.66636757e-03, -1.90024331e-01, -9.42566693e-02],
        [ 7.68162906e-02,  1.02819629e-01, -8.79386663e-02, ...,
          3.91472951e-02,  2.40295622e-02, -1.68459993e-02]],

       [[-6.61616847e-02,  2.02311382e-01, -9.32475328e-02, ...,
         -5.47063015e-02, -3.75632122e-02,  2.20554206e-03],
        [-3.08679342e-02,  1.76376067e-02,  1.84876006e-02, ...,
          6.28017634e-02,  1.11062080e-01,  1.80095509e-01],
        [-9.49872360e-02,  8.50322619e-02,  1.02127111e-02, ...,
         -7.62672573e-02, -5.74975498e-02, -1.39634302e-02],
        ...,
        [ 1.26618996e-01,  8.39484110e-02,  1.65105481e-02, ...,
          1.74663719e-02,  5.25389165e-02,  4.25899215e-02],
        [-9.43085253e-02, -6.00911640e-02, -1.05924807e-01, ...,
          8.14405978e-02, -5.96398599e-02,  1.86736193e-02],
        [ 1.94719031e-01, -5.42505272e-03,  1.49333933e-02, ...,
         -1.61014155e-01,  8.50968584e-02, -1.57452188e-02]]]]]

test_cc_averagepool_3d_dilations_large_count_include_pad_is_0_ceil_mode_is_True

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [5, 5, 5]
    strides = [3, 3, 3]
    dilations = [2, 2, 2]
    count_include_pad = 0
    ceil_mode = 1
Inputs:
  x: shape=(1, 1, 32, 32, 32), dtype=float32
    [[[[[ 0.6826989 , -1.0636308 , -0.49599636, ...,  0.58570313,  0.36927426,
         -0.5570493 ],
        [ 0.58355564, -0.55416816,  2.5328057 , ..., -1.4399773 ,  0.75520545,
         -1.5004631 ],
        [ 0.53266686,  1.5267844 ,  0.2970361 , ...,  2.437409  , -1.191171  ,
          0.5297386 ],
        ...,
        [ 0.19859445,  0.18504293, -1.2340089 , ...,  1.0704514 , -0.52578866,
          0.8806426 ],
        [-0.79434   , -0.35745475,  1.5052589 , ...,  0.816934  ,  0.1661996 ,
         -1.9891509 ],
        [-0.73371494, -2.157008  , -2.0006335 , ...,  0.14417553,  1.9946597 ,
          1.6907712 ]],

       [[ 0.33751163,  0.732381  ,  0.7397368 , ..., -1.1159421 , -0.69318265,
         -0.74580556],
        [ 1.0505737 , -1.0654345 ,  0.65605813, ...,  0.39389288, -1.6604007 ,
         -1.5399394 ],
        [-0.05093908,  1.1553425 , -0.34441727, ...,  0.6835469 ,  0.1275579 ,
          0.4961639 ],
        ...,
        [ 0.8910747 , -0.66706914,  1.4459534 , ...,  1.794959  ,  0.21274863,
          0.22813495],
        [ 1.4084834 ,  0.05165602,  0.54921865, ..., -1.2152545 , -1.0510696 ,
          0.2935332 ],
        [ 0.8208255 ,  0.2694287 , -0.50953877, ...,  0.25289893, -0.4114577 ,
          0.810204  ]],

       [[ 0.4342118 , -0.18045701,  1.3883895 , ..., -1.2517263 ,  0.7920498 ,
          2.181665  ],
        [ 1.4986454 ,  0.22203891,  0.56103116, ...,  2.4566543 ,  0.26518747,
          0.22093198],
        [-1.3515848 , -1.1267309 , -2.1434646 , ..., -0.9229038 , -0.3992776 ,
          1.9223666 ],
        ...,
        [ 0.70338684,  0.22514625, -0.89275956, ...,  0.19109921,  0.28014252,
          0.77363926],
        [ 1.2787733 , -0.5189319 ,  0.35596678, ..., -0.52978283, -0.13604172,
          0.08617226],
        [-0.30677044,  0.4249386 , -0.82721245, ..., -0.07596817, -0.02248115,
          0.6348855 ]],

       ...,

       [[ 0.91498613,  0.40066925,  0.44108564, ..., -1.1143696 ,  1.1147262 ,
         -0.31588614],
        [ 0.01209362,  0.42207065, -0.91208315, ...,  0.64747244,  0.6453611 ,
         -1.107794  ],
        [-1.6733036 ,  0.70226604, -0.8286473 , ..., -0.01322079, -0.05958286,
          0.20060237],
        ...,
        [-1.7734197 , -0.48459914, -0.9906168 , ...,  0.26008686,  1.3715158 ,
          0.15963374],
        [-0.13888055, -0.20156308, -0.9371126 , ..., -1.3894018 ,  1.0703477 ,
         -0.41075906],
        [ 0.20482461,  0.13418819, -0.98273945, ..., -0.7350279 ,  0.36442932,
         -1.4801017 ]],

       [[ 1.1377641 ,  0.15796512,  2.2017329 , ...,  1.199016  , -0.9357617 ,
         -0.3312036 ],
        [-0.08035636, -1.043841  , -0.6928017 , ...,  1.0281613 , -0.893024  ,
          0.5415216 ],
        [-1.0615951 ,  0.02062927,  0.51837695, ..., -0.3716156 ,  0.3138743 ,
         -0.884322  ],
        ...,
        [ 2.4137554 , -1.7811245 ,  0.9531711 , ..., -0.37298423,  1.225608  ,
          0.4052783 ],
        [-0.0729888 , -0.74384445, -0.84863067, ...,  0.13784313, -1.7208381 ,
         -1.0501585 ],
        [ 0.12288951,  0.3995373 , -2.2959752 , ..., -0.7755374 ,  0.09848155,
         -0.7200147 ]],

       [[ 0.58550096,  1.2657781 , -0.7983138 , ...,  0.51697016, -0.9485152 ,
          0.21051317],
        [ 1.0790918 , -1.1245176 , -0.8107783 , ...,  0.76874447,  1.6500686 ,
          0.68070936],
        [-0.09759749, -0.2557402 ,  0.44444928, ...,  2.4123259 ,  1.0454658 ,
         -0.6750987 ],
        ...,
        [ 1.6734787 , -2.4699273 , -0.24986318, ..., -0.5482568 ,  0.6026272 ,
          2.4697144 ],
        [-0.04526229,  0.411924  ,  0.5174419 , ...,  1.5789136 ,  0.16601937,
         -0.1387786 ],
        [-0.5708365 , -0.37441486, -1.3545084 , ...,  0.29226893,  0.57038677,
          0.46713367]]]]]

Outputs:
  y: shape=(1, 1, 9, 9, 9), dtype=float32
    [[[[[-0.02949851,  0.0641727 ,  0.00591729, ..., -0.08398312, -0.05300469,
         -0.00425622],
        [-0.12236945, -0.08487796, -0.15041819, ...,  0.08696795,  0.19935192,
          0.02168223],
        [ 0.03350687,  0.03785192, -0.0375563 , ..., -0.10192573,  0.03040757,
         -0.00435418],
        ...,
        [-0.07964142,  0.04005096,  0.10956652, ...,  0.07624657, -0.08739367,
          0.05713723],
        [ 0.14891584,  0.00225253,  0.04670913, ..., -0.07322567,  0.03749146,
         -0.20901573],
        [-0.08949101,  0.3174807 , -0.02123646, ...,  0.02572586,  0.03137747,
         -0.07421488]],

       [[ 0.12890378, -0.10251042,  0.15129216, ..., -0.05434014, -0.08998796,
         -0.09985543],
        [-0.00351062,  0.04350684, -0.06818946, ..., -0.20417017,  0.01992202,
         -0.09378678],
        [ 0.0118101 , -0.1319466 ,  0.0130125 , ..., -0.03905901, -0.00886845,
         -0.11027266],
        ...,
        [ 0.00048699, -0.13089791,  0.02533138, ...,  0.00499387, -0.06922881,
          0.16711262],
        [ 0.21028635,  0.07690264,  0.00922431, ...,  0.00471363, -0.17447521,
         -0.1033147 ],
        [ 0.11733514,  0.08864205, -0.03685794, ..., -0.06665926,  0.01099739,
          0.12196634]],

       [[ 0.05368516, -0.03257625,  0.04502436, ..., -0.02808548,  0.03412473,
          0.00815951],
        [ 0.00632601, -0.07556855, -0.009043  , ...,  0.17624407,  0.10350481,
          0.3328624 ],
        [ 0.09535346,  0.02577749,  0.01897472, ...,  0.03420767,  0.06464946,
          0.165407  ],
        ...,
        [-0.15413345,  0.07831104, -0.13379475, ..., -0.02891177, -0.05794182,
         -0.1277539 ],
        [-0.07913718,  0.10948386, -0.06419283, ..., -0.01139784, -0.02148273,
         -0.18400423],
        [-0.1123024 ,  0.22974133, -0.08634831, ...,  0.04561997,  0.0061299 ,
         -0.04469116]],

       ...,

       [[-0.17835791, -0.03645764, -0.15453993, ...,  0.1700221 ,  0.00621954,
          0.06086355],
        [ 0.02177665, -0.05933857, -0.15404588, ...,  0.16068897,  0.13139571,
         -0.14995693],
        [-0.07585039,  0.00955928, -0.06447435, ...,  0.12693816,  0.15249448,
         -0.0022717 ],
        ...,
        [ 0.0938037 , -0.07834665, -0.09401724, ...,  0.10351133, -0.07743272,
          0.04299737],
        [-0.03559978,  0.02529951,  0.07992065, ...,  0.07903534,  0.0507629 ,
          0.13326766],
        [ 0.11181739, -0.03481057, -0.15610981, ..., -0.04203871, -0.10540992,
          0.06816625]],

       [[ 0.04489743, -0.13278198,  0.20702468, ..., -0.06218794,  0.02729125,
         -0.12397936],
        [-0.20716394, -0.04462929, -0.0835807 , ..., -0.02550249,  0.036755  ,
         -0.09790802],
        [-0.02957846, -0.02555323, -0.02838363, ..., -0.14932536,  0.00148937,
         -0.02377506],
        ...,
        [ 0.0010956 , -0.08902714,  0.02920258, ..., -0.00213483, -0.0859843 ,
          0.17005551],
        [-0.01648514, -0.07834811,  0.10219354, ..., -0.08091772,  0.03908823,
         -0.00230861],
        [-0.15577331, -0.00375714, -0.21062033, ...,  0.08837084, -0.15854892,
          0.12107204]],

       [[-0.095157  , -0.05377833, -0.09446343, ..., -0.06005633, -0.00182744,
         -0.03301802],
        [ 0.13202791, -0.02646997,  0.01675908, ...,  0.10459549,  0.12293711,
         -0.02429296],
        [-0.13029699,  0.12673418, -0.08713004, ...,  0.00107191,  0.07247996,
         -0.02391056],
        ...,
        [-0.17092027, -0.26323766, -0.05298314, ...,  0.0478102 , -0.12062932,
          0.04320052],
        [ 0.00650066, -0.13047619,  0.09768295, ...,  0.10514384,  0.05119287,
          0.02315527],
        [-0.14099343, -0.00924661, -0.06091939, ..., -0.03940618,  0.00263229,
         -0.03163489]]]]]

test_cc_averagepool_3d_dilations_large_count_include_pad_is_1_ceil_mode_is_False

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [5, 5, 5]
    strides = [3, 3, 3]
    dilations = [2, 2, 2]
    count_include_pad = 1
    ceil_mode = 0
Inputs:
  x: shape=(1, 1, 32, 32, 32), dtype=float32
    [[[[[-1.1800952 ,  1.5282804 , -0.927722  , ...,  0.90036064,  0.4508079 ,
          0.50713205],
        [-1.4286486 , -0.7234132 ,  0.8920742 , ...,  0.14522634, -1.3828917 ,
          0.7667151 ],
        [-0.46654087,  1.1135737 ,  0.42477185, ..., -0.26278242,  1.4668891 ,
          0.8182846 ],
        ...,
        [-0.26084018, -0.57114136,  0.12217946, ..., -1.725338  , -0.98447305,
         -0.07685646],
        [ 2.8033047 , -0.55244184,  0.43159074, ...,  1.9395163 , -0.72577435,
         -1.2882543 ],
        [ 0.0931088 , -0.25115004, -1.8707552 , ...,  2.2768936 ,  0.43603235,
          0.41013682]],

       [[ 0.11133784, -1.4511776 , -0.7650855 , ..., -0.4652658 ,  0.6886972 ,
          0.7030136 ],
        [ 1.0726    , -0.08191815, -0.80462724, ...,  0.40402493, -0.707478  ,
         -1.2769008 ],
        [ 0.23197915, -0.49155653,  2.9273658 , ..., -0.06545418,  0.7643661 ,
         -1.1236305 ],
        ...,
        [ 0.9743983 ,  0.6494989 ,  1.2572792 , ...,  0.21951553, -1.6917206 ,
          1.5031337 ],
        [ 1.9166442 ,  1.5201567 ,  0.6692547 , ...,  1.2367532 , -0.04916853,
         -2.313987  ],
        [-0.4246133 , -1.8090019 , -1.7186022 , ...,  0.5162749 , -0.2443945 ,
          0.6915053 ]],

       [[-0.7477591 , -0.54184794,  1.3026123 , ..., -0.3341609 , -1.7547895 ,
          0.24542978],
        [ 0.86067235,  0.06022695,  0.9986335 , ...,  0.40013635, -0.01964767,
         -1.7965401 ],
        [-0.7275269 , -1.6365947 ,  0.5193215 , ...,  0.33226317, -0.41244927,
          1.1007545 ],
        ...,
        [-0.01003757, -0.9918609 ,  0.9971849 , ..., -0.11926777, -0.27765867,
          0.2415979 ],
        [-1.0325637 ,  0.91980165,  0.3425035 , ..., -0.8682178 ,  0.58522743,
          0.2851827 ],
        [ 0.04504509,  0.57338405,  0.7124989 , ...,  0.93364775, -1.6920713 ,
         -0.4929778 ]],

       ...,

       [[-0.29054886, -0.32745013,  0.17159043, ..., -0.4191606 , -1.7472563 ,
         -0.46509573],
        [-0.30730134, -0.17121895, -0.03240692, ...,  1.2859651 , -0.38461524,
         -0.29280394],
        [-1.4828904 , -0.21620677, -0.34414887, ...,  0.31217977,  0.4220281 ,
          1.237209  ],
        ...,
        [-0.30688602, -0.45300078,  0.21115218, ...,  1.0794559 , -0.16528098,
          1.1349841 ],
        [-0.42714772,  2.3923526 , -2.893512  , ..., -0.02703227, -0.6203007 ,
         -1.6943831 ],
        [ 0.21926764,  0.6370277 ,  0.8930731 , ...,  1.3161826 ,  0.08996633,
         -0.10725895]],

       [[-0.43484098, -0.03370046,  1.9041871 , ...,  1.1876247 , -0.89896405,
         -0.19932939],
        [-0.36621612, -0.3121352 , -0.39117014, ..., -0.02891317,  1.4814743 ,
          0.96177113],
        [ 0.5067251 ,  1.9094753 ,  0.8491461 , ...,  0.5161549 , -1.0698717 ,
         -0.33041227],
        ...,
        [-0.1228703 ,  0.4871805 , -1.3708917 , ..., -0.2982958 , -1.5682013 ,
          0.4197401 ],
        [ 1.021368  ,  0.09179218,  0.28905973, ..., -0.5492047 ,  0.18590285,
          0.6678246 ],
        [ 1.2843945 , -1.4589952 ,  0.9692793 , ...,  0.7025427 , -0.6946531 ,
         -1.2113824 ]],

       [[-0.8105382 , -0.28333092,  0.8007455 , ...,  1.3140367 ,  0.2146312 ,
         -2.2203894 ],
        [-0.98381233, -1.4640635 ,  1.2504165 , ..., -0.6028902 , -1.5439253 ,
         -0.15634273],
        [-0.582631  , -2.0560188 , -0.01328099, ...,  0.8653448 , -0.29422975,
          0.12111578],
        ...,
        [-1.0317372 ,  0.32146022,  3.1908205 , ..., -0.2931802 , -0.75956136,
          0.46387216],
        [ 1.4818231 ,  0.7792885 ,  1.2985512 , ..., -0.35706887, -0.8174048 ,
          1.0223914 ],
        [ 0.75298923, -0.74275136,  1.007037  , ..., -1.7349303 ,  0.81268376,
          1.0369678 ]]]]]

Outputs:
  y: shape=(1, 1, 8, 8, 8), dtype=float32
    [[[[[-1.50502503e-01,  6.59713373e-02, -3.76842581e-02, ...,
         -9.66570154e-02, -1.63718835e-02, -4.63637188e-02],
        [ 6.10464364e-02, -8.46517012e-02,  4.05129381e-02, ...,
          1.10355392e-01, -1.47993177e-01,  9.14520398e-02],
        [ 4.28548455e-02, -7.65601993e-02, -5.56198917e-02, ...,
          4.63781878e-02, -5.52641526e-02,  2.25309609e-03],
        ...,
        [-9.26965624e-02, -1.06960453e-01, -1.03397578e-01, ...,
         -9.69205126e-02, -6.98702633e-02,  3.17638107e-02],
        [ 4.35601771e-02, -8.72974098e-02,  5.84910959e-02, ...,
          8.43122080e-02, -1.11665308e-01, -4.38262895e-03],
        [-6.60059974e-02, -1.53356239e-01, -8.94945934e-02, ...,
         -5.51138595e-02, -6.39091665e-03, -7.92832226e-02]],

       [[-8.52090120e-02,  1.68608800e-01, -1.58284605e-01, ...,
          1.53769374e-01, -1.05773740e-01,  3.11140418e-02],
        [ 1.44126983e-02, -5.45811281e-03,  4.78336066e-02, ...,
          3.91400233e-02,  3.82246524e-02, -1.07226461e-01],
        [-7.74474815e-02,  1.07830502e-01, -8.25407356e-02, ...,
          5.99955348e-03,  2.79254355e-02,  1.21256076e-01],
        ...,
        [-1.17734902e-01,  3.27230766e-02, -4.84264344e-02, ...,
         -1.37787098e-02, -5.30919209e-02,  1.05981231e-01],
        [ 1.30983382e-01,  9.21023041e-02,  1.30413873e-02, ...,
         -2.34555975e-02, -4.88656685e-02,  3.93324904e-02],
        [-3.47352922e-02,  2.12590754e-01,  6.93463488e-03, ...,
          5.20653045e-03, -1.11241415e-01,  1.44152418e-01]],

       [[-1.03347711e-01,  1.55885309e-01, -2.93575376e-02, ...,
          3.94489337e-03,  5.74467182e-02,  1.66957617e-01],
        [-6.54983683e-04, -9.78810117e-02, -6.06847554e-02, ...,
          1.21320948e-01,  1.26713538e-03, -7.74745736e-03],
        [-3.12952744e-03, -1.17558800e-01,  8.01925585e-02, ...,
         -2.02957075e-02,  2.18668655e-02,  6.63819909e-02],
        ...,
        [-5.28101698e-02,  2.33838949e-02,  4.12669145e-02, ...,
          3.38962898e-02,  2.23575249e-01,  2.43859831e-02],
        [ 3.10853142e-02, -2.91036107e-02, -1.86850186e-02, ...,
         -2.33473238e-02, -7.49887601e-02,  3.29956301e-02],
        [-7.79273808e-02,  1.76318979e-04,  8.86662770e-03, ...,
         -4.59796451e-02,  1.47274017e-01, -7.03293607e-02]],

       ...,

       [[-7.94885606e-02, -6.89465599e-03, -1.45586446e-01, ...,
          8.59971344e-02,  8.99567753e-02,  7.28485063e-02],
        [ 7.31943250e-02, -6.66853413e-02, -1.36241376e-01, ...,
          2.92114746e-02,  4.97104190e-02,  4.07741917e-03],
        [ 2.79381983e-02,  2.36405823e-02, -6.17787093e-02, ...,
          3.87953216e-04,  4.39415202e-02, -1.36870258e-02],
        ...,
        [-1.05003700e-01,  1.18551672e-01, -5.65987341e-02, ...,
         -1.82478353e-02,  7.04376474e-02, -7.45700151e-02],
        [-6.48869723e-02, -1.42451441e-02,  4.13642079e-02, ...,
         -2.70117484e-02, -8.87719262e-03, -1.92668494e-02],
        [-4.57829535e-02,  1.05062097e-01,  6.22704905e-03, ...,
         -1.57194823e-01,  1.48723364e-01,  5.64892478e-02]],

       [[-9.01209638e-02,  5.05470186e-02, -1.44175544e-01, ...,
         -3.53143923e-02,  8.04652497e-02, -2.92313863e-02],
        [ 3.80561538e-02, -9.56769809e-02,  1.72714606e-01, ...,
          2.52949987e-02, -8.14457387e-02,  2.73003336e-03],
        [-3.00158560e-02,  7.42159858e-02, -3.20598707e-02, ...,
         -6.13157498e-03,  1.69063821e-01, -8.92537553e-03],
        ...,
        [-3.50725614e-02, -1.28363326e-01,  3.82031575e-02, ...,
         -2.24578027e-02, -1.29304789e-02,  1.52077198e-01],
        [ 3.85487489e-02, -6.54045194e-02, -1.42129827e-02, ...,
         -6.41250089e-02,  5.58192804e-02, -3.74435051e-03],
        [-1.59768745e-01, -2.10480615e-01, -3.62806581e-02, ...,
         -4.26099636e-03, -7.85103440e-02,  1.20908447e-01]],

       [[ 1.86275467e-02, -5.06193154e-02, -2.59485580e-02, ...,
          2.69993488e-02,  8.42456594e-02,  1.38000682e-01],
        [ 9.41585302e-02, -1.38379619e-01,  2.57642921e-02, ...,
          5.26217707e-02,  8.10027719e-02,  1.21964045e-01],
        [-4.85302396e-02,  1.04979329e-01, -1.40322432e-01, ...,
         -2.88425814e-02,  2.18894720e-01, -4.31691930e-02],
        ...,
        [-1.37034559e-03,  1.07522167e-01, -1.25556007e-01, ...,
         -7.25973621e-02,  1.30433202e-01, -2.13695187e-02],
        [-4.53268439e-02,  3.67005132e-02,  8.73440504e-02, ...,
         -4.28399593e-02, -1.89903975e-01, -5.03498204e-02],
        [ 4.58348095e-02,  8.08463469e-02, -1.30181685e-02, ...,
          5.72203379e-03,  1.40764639e-01,  1.42455623e-01]]]]]

test_cc_averagepool_3d_dilations_large_count_include_pad_is_1_ceil_mode_is_True

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [5, 5, 5]
    strides = [3, 3, 3]
    dilations = [2, 2, 2]
    count_include_pad = 1
    ceil_mode = 1
Inputs:
  x: shape=(1, 1, 32, 32, 32), dtype=float32
    [[[[[-1.049021  , -0.1805252 ,  0.37299186, ...,  1.5876821 ,  1.2864141 ,
         -1.5520498 ],
        [-0.9380287 , -1.4733943 , -2.022197  , ..., -0.9698782 , -0.54079443,
         -0.80199915],
        [ 0.4963801 ,  0.8820354 , -1.1440474 , ..., -1.5149921 ,  0.00689778,
          0.5175069 ],
        ...,
        [ 0.00837255, -0.42359757, -1.1596063 , ...,  1.4548734 ,  1.0391518 ,
         -0.6878789 ],
        [-0.3840185 , -1.3418033 ,  0.03540244, ..., -1.0135608 ,  0.49729598,
         -1.4357247 ],
        [ 0.8646517 ,  0.50934225,  0.02258277, ..., -0.10640429, -0.3976738 ,
         -1.1821032 ]],

       [[-0.86178017,  1.0939201 , -1.837826  , ..., -0.91427237,  0.07795895,
          1.5907503 ],
        [-0.1712651 ,  0.05782282, -1.2460403 , ...,  1.7505339 ,  0.24070641,
          0.20844889],
        [ 0.61328685, -0.5156572 ,  1.2294496 , ..., -1.419917  , -0.21442635,
          0.9527964 ],
        ...,
        [-1.6370897 ,  1.6808282 , -0.29286   , ...,  1.9242676 , -2.9861572 ,
         -1.1693318 ],
        [-0.60160494,  1.0480051 , -0.6501521 , ...,  0.5319851 , -0.73177665,
          1.392903  ],
        [ 0.26866493, -0.9377319 , -0.22525693, ..., -1.6419183 , -0.36520287,
         -0.7277442 ]],

       [[-0.5967695 ,  0.3987772 ,  2.14742   , ...,  0.33250213, -0.1497071 ,
          0.18792532],
        [-2.3833086 , -0.01096996,  1.37878   , ..., -0.1153855 ,  1.4562176 ,
         -0.9957842 ],
        [-0.33676842,  0.20755944, -0.01002988, ...,  1.0421441 , -0.8252797 ,
          0.5002798 ],
        ...,
        [ 1.331366  ,  1.5299598 , -1.7203652 , ..., -0.5154225 ,  0.14837329,
         -0.20567068],
        [-0.55949867,  0.8830553 ,  0.9573955 , ..., -0.54890376, -0.12601969,
         -1.5479167 ],
        [ 0.30606514, -0.9562404 , -0.39455226, ...,  0.32819682,  1.187972  ,
          0.49606502]],

       ...,

       [[-1.1021332 ,  0.55112803,  1.5328958 , ..., -0.18161117,  0.93350565,
          0.89873594],
        [-0.5722752 , -1.5484419 ,  0.20279455, ..., -1.9326184 , -0.777557  ,
          0.56579757],
        [-0.15523608, -0.7600384 , -0.07781883, ..., -0.24969102,  1.8799074 ,
         -0.71477836],
        ...,
        [ 0.37206063,  1.455978  , -0.8617367 , ..., -0.6590294 ,  0.56862   ,
          1.2937711 ],
        [-0.06830038, -0.5405711 ,  2.9981098 , ..., -0.6848708 ,  1.492449  ,
         -0.07670687],
        [ 1.8033153 , -0.22747356, -0.7047139 , ..., -0.97916853,  1.4828932 ,
          1.2225666 ]],

       [[ 0.97283214, -0.8032011 , -0.2632081 , ...,  0.7543573 , -0.99890745,
         -0.6912811 ],
        [-0.829292  , -1.1413032 ,  0.90359914, ...,  0.932079  , -2.6836314 ,
         -0.47466826],
        [ 1.0191394 ,  1.2299243 ,  0.84587425, ...,  0.8834575 ,  0.97003436,
         -1.6266407 ],
        ...,
        [ 0.30760813, -0.83914244, -0.8490113 , ..., -0.10961673, -0.6388409 ,
          0.9228437 ],
        [ 0.79653156,  0.7919692 ,  1.5712339 , ...,  0.5142292 ,  0.7065386 ,
         -2.348413  ],
        [ 0.8820707 ,  0.27064463,  1.6352019 , ...,  1.3843328 , -0.06968505,
          1.0428629 ]],

       [[ 1.5875206 ,  1.5284623 , -1.4720782 , ..., -0.36300224,  0.8952138 ,
          1.222305  ],
        [-0.97385424,  0.2838812 , -0.9982251 , ..., -0.5102851 ,  0.02550081,
          0.25321773],
        [ 0.21191923,  0.81784743, -0.39068377, ..., -0.96625745, -0.49508005,
         -0.22434995],
        ...,
        [-1.3947823 ,  1.8776352 , -0.56686014, ...,  0.16465001, -0.60312515,
          0.7453348 ],
        [ 0.6791353 , -0.959116  ,  1.0387828 , ...,  0.9274563 ,  1.061921  ,
         -0.58185154],
        [ 0.25896376,  0.11629719, -0.9185214 , ..., -0.04697152,  0.38483706,
          0.9290582 ]]]]]

Outputs:
  y: shape=(1, 1, 9, 9, 9), dtype=float32
    [[[[[ 0.10408693, -0.12780401, -0.05483485, ...,  0.17148903,  0.00476223,
          0.12172922],
        [-0.00509301,  0.06940365,  0.06304774, ..., -0.1255803 , -0.1329587 ,
         -0.03365081],
        [ 0.07938646, -0.11964417,  0.1479133 , ...,  0.10441932, -0.13602029,
          0.19705737],
        ...,
        [-0.05828143,  0.04112368, -0.0053585 , ...,  0.00251056,  0.01886939,
         -0.13792999],
        [ 0.01901706,  0.01381862,  0.04953435, ..., -0.00199189, -0.0841973 ,
         -0.08337   ],
        [-0.12579829,  0.02720457, -0.15238221, ...,  0.08153057,  0.14555614,
         -0.20594133]],

       [[ 0.06899133,  0.1680838 ,  0.02259945, ...,  0.13515495,  0.16972893,
         -0.07212706],
        [-0.01268352,  0.149081  ,  0.01520448, ..., -0.02416891,  0.03465341,
          0.16020432],
        [-0.11519367,  0.05529507, -0.14412788, ...,  0.15321687,  0.1085779 ,
         -0.05865718],
        ...,
        [ 0.0993674 , -0.13638832,  0.06470343, ..., -0.01804093,  0.0845187 ,
          0.03123249],
        [-0.19073151,  0.00216477, -0.05670807, ...,  0.02736948, -0.01350194,
         -0.1156719 ],
        [-0.08975383,  0.00283859, -0.01155804, ..., -0.11258676, -0.05062841,
         -0.07271472]],

       [[ 0.03437879, -0.1509759 ,  0.11026427, ...,  0.17393157, -0.02947093,
         -0.03529677],
        [ 0.01306489,  0.04455595, -0.03672243, ..., -0.02387845,  0.00315391,
          0.01423831],
        [ 0.02460663, -0.09252031,  0.13054088, ...,  0.20032927, -0.21689157,
          0.05069862],
        ...,
        [-0.09085549, -0.00500213, -0.12496763, ...,  0.06044474, -0.02178502,
          0.07323676],
        [ 0.01223858, -0.12728053,  0.05434434, ..., -0.07540174,  0.058762  ,
          0.03840666],
        [-0.09880864,  0.05402513, -0.06810322, ...,  0.06095927,  0.03333457,
          0.00476578]],

       ...,

       [[-0.0968798 ,  0.02208971, -0.18149832, ..., -0.00947461,  0.03870352,
         -0.1386803 ],
        [ 0.10758711,  0.07920609,  0.04758861, ..., -0.09094913,  0.00771792,
         -0.1686401 ],
        [-0.19226804, -0.01464502, -0.32868373, ..., -0.03185991,  0.03869693,
         -0.05962313],
        ...,
        [-0.06801105,  0.09949668, -0.03211804, ..., -0.01507752,  0.08259698,
         -0.01780495],
        [ 0.00843976, -0.08345675, -0.05629781, ...,  0.15415956, -0.04186502,
          0.16250786],
        [ 0.0606999 ,  0.2021989 ,  0.02160939, ..., -0.1522501 ,  0.00281139,
         -0.09132669]],

       [[ 0.00640839, -0.02709669,  0.01340933, ..., -0.09452748, -0.18437485,
         -0.1540544 ],
        [ 0.10081506,  0.06895395,  0.00644034, ..., -0.08526295, -0.17706569,
         -0.05593618],
        [-0.13754864, -0.06591412, -0.00191048, ...,  0.04170632, -0.1924466 ,
         -0.15805817],
        ...,
        [-0.19806434,  0.06762959, -0.15181985, ..., -0.0085573 , -0.07110538,
          0.16962144],
        [-0.13194527,  0.09444708, -0.1454719 , ...,  0.01902385,  0.08527766,
         -0.02715297],
        [-0.15838043,  0.0363803 , -0.17355402, ..., -0.02952464, -0.07753027,
          0.17390005]],

       [[-0.11070134, -0.00348838, -0.0978388 , ..., -0.19329251,  0.02329318,
         -0.25337747],
        [ 0.08387358,  0.05375688,  0.03721736, ...,  0.02993742, -0.00097975,
         -0.13186356],
        [-0.08950625, -0.11911523, -0.08945019, ..., -0.08077504, -0.03491307,
         -0.09458859],
        ...,
        [-0.03484718,  0.08965995,  0.02557977, ..., -0.12312265,  0.13136476,
         -0.07817482],
        [ 0.08345939,  0.10244542, -0.15416956, ..., -0.00706416, -0.06605808,
          0.08008105],
        [ 0.00714533,  0.19479586,  0.03075719, ..., -0.13510036,  0.06532932,
         -0.05115438]]]]]

test_cc_averagepool_3d_dilations_small

Node:
  AveragePool(x) -> (y)
  Attributes:
    kernel_shape = [2, 2, 2]
    strides = [1, 1, 1]
    dilations = [2, 2, 2]
    ceil_mode = 1
Inputs:
  x: shape=(1, 1, 4, 4, 4), dtype=float32
    [[[[[ 1.,  2.,  3.,  4.],
        [ 5.,  6.,  7.,  8.],
        [ 9., 10., 11., 12.],
        [13., 14., 15., 16.]],

       [[ 1.,  2.,  3.,  4.],
        [ 5.,  6.,  7.,  8.],
        [ 9., 10., 11., 12.],
        [13., 14., 15., 16.]],

       [[ 1.,  2.,  3.,  4.],
        [ 5.,  6.,  7.,  8.],
        [ 9., 10., 11., 12.],
        [13., 14., 15., 16.]],

       [[ 1.,  2.,  3.,  4.],
        [ 5.,  6.,  7.,  8.],
        [ 9., 10., 11., 12.],
        [13., 14., 15., 16.]]]]]

Outputs:
  y: shape=(1, 1, 2, 2, 2), dtype=float32
    [[[[[ 6.,  7.],
        [10., 11.]],

       [[ 6.,  7.],
        [10., 11.]]]]]

Differences with previous version (11)#

SchemaDiff: AveragePool (domain 'ai.onnx')

  • old version: 11

  • new version: 19

  • breaking: no

Documentation:

  • line similarity: 0.63 (+13/-10 lines)

--- AveragePool v11
+++ AveragePool v19
@@ -3,28 +3,31 @@
  the tensor according to kernel sizes, stride sizes, and pad lengths.
  average pooling consisting of computing the average on all values of a
  subset of the input tensor according to the kernel size and downsampling the
- data into the output tensor Y for further processing. The output spatial shape will be following:
+ data into the output tensor Y for further processing. The output spatial shape is calculated differently
+ depending on whether explicit padding is used, where pads is employed, or auto padding is used, where auto_pad is utilized.
+ With explicit padding (https://pytorch.org/docs/stable/generated/torch.nn.MaxPool2d.html?highlight=maxpool#torch.nn.MaxPool2d):
  ```
- output_spatial_shape[i] = floor((input_spatial_shape[i] + pad_shape[i] - kernel_spatial_shape[i]) / strides_spatial_shape[i] + 1)
+ output_spatial_shape[i] = floor((input_spatial_shape[i] + pad_shape[i] - dilation[i] * (kernel_shape[i] - 1) - 1) / strides_spatial_shape[i] + 1)
  ```
  or
  ```
- output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - kernel_spatial_shape[i]) / strides_spatial_shape[i] + 1)
+ output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - dilation[i] * (kernel_shape[i] - 1) - 1) / strides_spatial_shape[i] + 1)
  ```
- if ceil_mode is enabled
+ if ceil_mode is enabled. `pad_shape[i]` is the sum of pads along axis `i`.

+ `auto_pad` is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following when ceil_mode is enabled:
  ```
- * pad_shape[i] is sum of pads along axis i
+ VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) + 1) / strides_spatial_shape[i])
+ SAME_UPPER or SAME_LOWER: output_spatial_shape[i] = ceil(input_spatial_shape[i] / strides_spatial_shape[i])
  ```
-
- `auto_pad` is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following:
+ or when ceil_mode is disabled (https://www.tensorflow.org/api_docs/python/tf/keras/layers/AveragePooling2D):
  ```
- VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - kernel_spatial_shape[i] + 1) / strides_spatial_shape[i])
- SAME_UPPER or SAME_LOWER: output_spatial_shape[i] = ceil(input_spatial_shape[i] / strides_spatial_shape[i])
+ VALID: output_spatial_shape[i] = floor((input_spatial_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1)) / strides_spatial_shape[i]) + 1
+ SAME_UPPER or SAME_LOWER: output_spatial_shape[i] = floor((input_spatial_shape[i] - 1) / strides_spatial_shape[i]) + 1
  ```
  And pad shape will be following if `SAME_UPPER` or `SAME_LOWER`:
  ```
- pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] + kernel_spatial_shape[i] - input_spatial_shape[i]
+ pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] + ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) - input_spatial_shape[i]
  ```
  The output of each pooling window is divided by the number of elements (exclude pad when attribute count_include_pad is zero).