|||
torch.nn.
AdaptiveAvgPool3d
(output_size)[SOURCE]
Applies a 3D adaptive average pooling over an input signal composed of several input planes.
The output is of size D x H x W, for any input size. The number of output features is equal to the number of input planes.
https://pytorch.org/docs/stable/nn.html?highlight=adaptive_avg_pool2d#torch.nn.AdaptiveAvgPool3d
you can use adaptive_avg_pool2d
390 to achieve global average pooling, just set the output size to (1, 1),
import torch.nn.functional as F
x = F.adaptive_avg_pool2d(x, (1, 1))
https://discuss.pytorch.org/t/global-average-pooling-in-pytorch/6721/9
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2025-1-10 23:23
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社