平均池化CNN中是常用的操作,下面介绍一下tensorflow中keras的GlobalAveragePooling2D和AveragePooling2D的返回的tensor的维度的区别。
GlobalAveragePooling2D是平均池化的一个特例,它不需要指定pool_size和strides等参数,操作的实质是将输入特征图的每一个通道求平均得到一个数值。它的输入和输出维度为:
Input shape:
- If `data_format='channels_last'`:
4D tensor with shape:
`(batch_size, rows, cols, channels)`
- If `data_format