Rate this Page

Softmax2d#

classtorch.nn.modules.activation.Softmax2d(*args,**kwargs)[source]#

Applies SoftMax over features to each spatial location.

When given an image ofChannelsxHeightxWidth, it willapplySoftmax to each location(Channels,hi,wj)(Channels, h_i, w_j)

Shape:
Returns

a Tensor of the same dimension and shape as the input withvalues in the range [0, 1]

Return type

None

Examples:

>>>m=nn.Softmax2d()>>># you softmax over the 2nd dimension>>>input=torch.randn(2,3,12,13)>>>output=m(input)
forward(input)[source]#

Runs the forward pass.

Return type

Tensor