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