Softmax2d#
- class torch.nn.modules.activation.Softmax2d(*args, **kwargs)[source]#
对每个空间位置应用特征上的 SoftMax。
当输入为
通道数 x 高度 x 宽度(Channels x Height x Width) 的图像时,它将对每个位置 应用 Softmax。- 形状
输入: 或 。
输出: 或 (与输入形状相同)
- 返回:
一个与输入具有相同维度和形状的张量,其值在 [0, 1] 范围内
- 返回类型:
无
示例
>>> m = nn.Softmax2d() >>> # you softmax over the 2nd dimension >>> input = torch.randn(2, 3, 12, 13) >>> output = m(input)