[object Object]

[object Object][object Object]undefined
[object Object]
  • Description:

    • Applies three-dimensional max pooling over the input channels of an input signal, and outputs the value out and indices after pooling.
    • In the input dims, N represents the batch size, C represents the channel, D represents the depth, W represents the width, and H represents the height.
    • If the product of D × H × W exceeds int32, it is recommended that the D axis be split based on the model size.
  • Formula:

    • Calculation formula of each element of the output tensor:

      out(Ni,Cj,d,h,w)=maxk[0,kD1],m[0,kH1],n[0,kW1]input(Ni,Cj,stride[0]×d+k,stride[1]×h+m,stride[2]×w+n)out(N_i, C_j, d, h, w) = \max\limits_{{k\in[0,k_{D}-1],m\in[0,k_{H}-1],n\in[0,k_{W}-1]}}input(N_i,C_j,stride[0]\times d + k, stride[1]\times h + m, stride[2]\times w + n)
    • Formula for deducing the output tensor shape (with ceilMode set to false by default, that is, rounding down)

      [N,C,Dout,Hout,Wout]=[N,C,Din+2×padding[0]dilation[0]×(kernelSize[0]1)1stride[0]+1,Hin+2×padding[1]dilation[1]×(kernelSize[1]1)1stride[1]+1,Win+2×padding[2]dilation[2]×(kernelSize[2]1)1stride[2]+1][N, C, D_{out}, H_{out}, W_{out}]=[N,C,\lfloor{\frac{D_{in}+2 \times {padding[0] - dilation[0] \times(kernelSize[0] - 1) - 1}}{stride[0]}}\rfloor + 1,\lfloor{\frac{H_{in}+2 \times {padding[1] - dilation[1] \times(kernelSize[1] - 1) - 1}}{stride[1]}}\rfloor + 1, \lfloor{\frac{W_{in}+2 \times {padding[2] - dilation[2] \times(kernelSize[2] - 1) - 1}}{stride[2]}}\rfloor + 1]
    • Formula for deducing the output tensor shape (with ceilMode set to true by default, that is, rounding up)

      [N,C,Dout,Hout,Wout]=[N,C,Din+2×padding[0]dilation[0]×(kernelSize[0]1)1stride[0]+1,Hin+2×padding[1]dilation[1]×(kernelSize[1]1)1stride[1]+1,Win+2×padding[2]dilation[2]×(kernelSize[2]1)1stride[2]+1][N, C, D_{out}, H_{out}, W_{out}]=[N,C,\lceil{\frac{D_{in}+2 \times {padding[0] - dilation[0] \times(kernelSize[0] - 1) - 1}}{stride[0]}}\rceil + 1,\lceil{\frac{H_{in}+2 \times {padding[1] - dilation[1] \times(kernelSize[1] - 1) - 1}}{stride[1]}}\rceil + 1, \lceil{\frac{W_{in}+2 \times {padding[2] - dilation[2] \times(kernelSize[2] - 1) - 1}}{stride[2]}}\rceil + 1]
[object Object]

Each operator has calls. First, aclnnMaxPool3dWithArgmaxGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnMaxPool3dWithArgmax is called to perform computation.

  • [object Object]
  • [object Object]
[object Object]
  • Parameters:

    • self (aclTensor*, compute input): input tensor, aclTensor on the device. The data type can only be FLOAT32, FLOAT16, or BFLOAT16. The shape can be four-dimensional or five-dimensional. are supported. The can be ND.
    • kernelSize (aclIntArray*, compute input): maximum pooling window size. The array length must be 1 or 3, and all array elements must be greater than 0.
    • stride (aclIntArray*, compute input): stride of the window. The array length must be 0, 1, or 3, and all array elements must be greater than 0. When the array length is 0, the value of kernelSize is used as strides.
    • padding (aclIntArray*, compute input): the number of layers of padding to be applied on each side, with negative infinity values used for padding. The array length must be 1 or 3, and all array elements must be greater than or equal to 0 and less than or equal to kernelSize divided by 2.
    • dilation (aclIntArray*, compute input): controls the stride between elements in the window. The array length must be 1 or 3, and the value can only be 1.
    • ceilMode (bool, compute input): mode of computing the output shape, that is, rounding up (True) or rounding down (False).
    • out (aclTensor *, compute output): output tensor, aclTensor on the device. It is the pooled result. The data type is the same as that of self. The shape is deduced from the preceding formula. The can be ND and must be the same as that of self.
    • indices (aclTensor *, compute output): output tensor, aclTensor on the device. This tensor consists of the index positions of maximum values. The data type can only be INT32. The shape is the same as that of out. The can be ND.
    • workspaceSize (uint64_t *, output): size of the workspace to be allocated on the device.
    • executor (aclOpExecutor **, output): operator executor, containing the operator computation process.
  • Returns:

    aclnnStatus: status code. For details, see .

[object Object]
[object Object]
  • Parameters:

    • workspace (void *, input): address of the workspace to be allocated on the device.
    • workspaceSize (uint64_t, input): size of the workspace to be allocated on the device, which is obtained by the first-phase API aclnnMaxPool3dWithArgmaxGetWorkspaceSize.
    • executor (aclOpExecutor *, input): operator executor, containing the operator computation process.
    • stream (aclrtStream, input): stream for executing the task.
  • Returns:

    aclnnStatus: status code. For details, see .

[object Object]
  • Deterministic compute:

    • aclnnMaxPool3dWithArgmax defaults to a deterministic implementation.
  • The data type of the input tensor can only be FLOAT32, FLOAT16, or BFLOAT16.

  • The input data format does not support NDHWC.

  • The kernelSize, stride, padding, dilation, and ceilMode parameters must ensure that no axis in the out shape is less than 1.

  • If ceilMode is set to True and sliding windows are all in the right padded region, the output result will be ignored.

[object Object]

The following example is for reference only. For details, see .

[object Object]