FilesLast commitLast update
4 months ago
3 months ago
23 days ago
8 days ago
8 days ago
23 days ago
8 days ago
1 month ago
17 days ago
README

AvgPool

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 2D average pooling on the input tensor with a window of kH∗kWkH * kW and a stride of sH∗sWsH * sW, where kk is kernelSize, indicating the size of the pooling window, and ss is stride, indicating the stride of the pooling operation.

  • Formula: The relationship between the input input (N,C,H,WN,C,H,W), the output out (N,C,Hout,WoutN,C,H_{out},W_{out}), the pooling stride (stridesstrides), and the pooling window size (kH,kWkH,kW) is

    Hout=⌊Hin+2∗paddings[0]−kHstrides[0]+1⌋H_{out}=\lfloor \frac{H_{in}+2*paddings[0]-kH}{strides[0]}+1 \rfloor

    Wout=⌊Win+2∗paddings[1]−kWstrides[1]+1⌋W_{out}=\lfloor \frac{W_{in}+2*paddings[1]-kW}{strides[1]}+1 \rfloor

    out(Ni,Ci,h,w)=1kH∗kW∑m=0kH−1∑n=0kW−1input(Ni,Ci,strides[0]∗h+m,strides[1]∗w+n)out(N_i,C_i,h,w)=\frac{1}{kH*kW}\sum_{m=0}^{kH-1}\sum_{n=0}^{kW-1}input(N_i,C_i,strides[0]*h+m,strides[1]*w+n)

Parameters

Parameter name Input/Output/Attribute Description Data type Data format
x Input Input tensor, input in the formula FLOAT, FLOAT16, BFLOAT16 ND
y Output Output tensor, output in the formula FLOAT, FLOAT16, BFLOAT16 ND
ksize Attribute Represents the pooling window size, `kernelSize` in the formula. INT64 -
strides Attribute Represents the stride of the pooling operation, `stride` in the formula. INT64 -
pads Attribute Represents the number of zero-padding layers on the D and H directions of the input, `padding` in the formula. INT64 -
data_format Optional attribute Represents the input data type. The default is NHWC STRING -

Constraints

None.

Invocation Description

Invocation method Sample code Description
Graph-mode interface test_geir_avg_pool Invokes the AvgPool operator through the IR-based AvgPool graph construction method.