PyTorch
torch / nn / torch.nn
Softmax2d¶
-
class
torch.nn.
Softmax2d
[source]¶ Applies SoftMax over features to each spatial location.
When given an image of
Channels x Height x Width
, it will apply Softmax to each location (Channels,hi,wj)- Shape:
Input: (N,C,H,W)
Output: (N,C,H,W) (same shape as input)
- Returns
a Tensor of the same dimension and shape as the input with values in the range [0, 1]
Examples:
>>> m = nn.Softmax2d() >>> # you softmax over the 2nd dimension >>> input = torch.randn(2, 3, 12, 13) >>> output = m(input)
此页内容是否对您有帮助
感谢反馈!