GlobalLpPool - version 1#

This page documents version 1 of operator GlobalLpPool. See GlobalLpPool for the latest version (since version 22).

  • Domain: ai.onnx

  • Since version: 1

GlobalLpPool consumes an input tensor X and applies lp pool pooling across the values in the same channel. This is equivalent to LpPool with kernel size equal to the spatial dimension of input tensor.

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 dimension are in the form of (N x C x D1 x D2 … Dn), where N is the batch size.

Outputs

  • Y (T): Output data tensor from pooling across the input tensor. Dimensions will be N x C x 1 x 1

Type Constraints

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

Examples#

test_cc_globallppool_1d_p3_opset1

Node:
  GlobalLpPool(x) -> (y)
  Attributes:
    p = 3.0
Inputs:
  x: shape=(1, 2, 2), dtype=float32
    [[[-1.,  2.],
      [-3.,  4.]]]

Outputs:
  y: shape=(1, 2, 1), dtype=float32
    [[[2.0800838],
      [4.4979415]]]

test_cc_globallppool_3d_opset1

Node:
  GlobalLpPool(x) -> (y)
  Attributes:
    p = 1.0
Inputs:
  x: shape=(1, 1, 2, 1, 2), dtype=float32
    [[[[[-1.,  2.]],

       [[-3.,  4.]]]]]

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

test_cc_globallppool_default_opset1

Node:
  GlobalLpPool(x) -> (y)
Inputs:
  x: shape=(1, 2, 2, 2), dtype=float32
    [[[[ 1., -2.],
       [ 3., -4.]],

      [[ 5., -6.],
       [ 7., -8.]]]]

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

      [[13.190906]]]]

test_cc_globallppool_fractional_p

Node:
  GlobalLpPool(x) -> (y)
  Attributes:
    p = 0.5
Inputs:
  x: shape=(1, 1, 3), dtype=float32
    [[[1., 4., 9.]]]

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