Softmax2d¶
- class torch.nn.Softmax2d(*args, **kwargs)[源代码]¶
对每个空间位置的特征应用SoftMax。
当给定一个
通道 x 高度 x 宽度的图像时,它将对每个位置应用Softmax。- Shape:
输入: 或 。
输出: 或 (与输入形状相同)
- Returns
与输入具有相同维度和形状的张量,其值在范围 [0, 1] 内
- Return type
无
示例:
>>> m = nn.Softmax2d() >>> # 你对第二个维度进行softmax >>> input = torch.randn(2, 3, 12, 13) >>> output = m(input)