FilesLast commitLast update
12 days ago
12 days ago
12 days ago
22 days ago
9 days ago
22 days ago
12 days ago
12 days ago
README

GlobalLpPool

English | 简体中文

Applicable Products

Product Support
Ascend 950PR&950DT products √
Atlas A3 products √
Atlas A2 products √
Atlas 200I/500 A2 inference products ×
Atlas inference products ×
Atlas training products ×

Function

  • Operator function: performs the global Lp pooling computation on the spatial dimensions of the input tensor, with the formula y = (sum(|x|^p))^(1/p), keeping the spatial dimensions as 1 (keepdims=True). Supports 4D(NCHW) and 5D(NCD0D1D2) inputs.

Parameters

Parameter name Input/Output/Attribute Description Data type Data format
x Input Input tensor for the global_lp_pool computation, 4D(NCHW) or 5D(NCD0D1D2). FLOAT, FLOAT16, BFLOAT16 ND
p Optional attribute Exponent p of the Lp norm. The default value is 2.0 (that is, the L2 norm). FLOAT -
y Output Global Lp pooling result. The spatial dimensions are reduced to 1, with the same dtype as input x. FLOAT, FLOAT16, BFLOAT16 ND

Constraints

  • The input tensor supports only the 4D(NCHW) or 5D(NCD0D1D2) dimensions.
  • Attribute p must be a finite non-zero value. p = 0, +Inf, -Inf or NaN are illegal inputs and are rejected by Host Tiling. Positive and negative finite values both follow the Lp-norm formula and have defined semantics.
  • Dynamic shape: dynamic shape (dimension -1) is supported; unknown Rank (-2) is not supported, and unknown Rank inputs are rejected by InferShape.
  • Empty tensor: when N×C = 0 the output is empty; when the spatial product is 0 (empty reduction), the output spatial dimensions are 1 and the value is always 0 (zero identity convention, for all p).

Invocation Description

Invocation method Sample code Description
Graph-mode interface test_geir_global_lp_pool Invokes the GlobalLpPool operator through graph construction with the operator IR. Build and run: bash build.sh --run_example global_lp_pool graph --soc=ascend950.