need an enhancement for softmax op.
Created by: NHZlX
The softmax activation in v2 paddle and fuild do the follwing operation.
The input of the softmax is a 2-D data with shape N x (C x H x W) (N is the batch_size, (C x H x W) is the dimension of input feature). The output tensor has the same shape as the input tensor.
In this situation, we defaults that the size of the input feature map for softmax is 1 * 1
. So the class num is C x H x W == C
.
But in some other situations, like segmentation etc. The final output feature map size is H x W
(H > 1 or W > 1). We should do softmax for each feature map's location, but not all the values of the output.