nn_softmax2d function

Softmax2d module

Softmax2d module

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)(Channels, h_i, w_j)

nn_softmax2d()

Returns

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

Shape

  • Input: (N,C,H,W)(N, C, H, W)
  • Output: (N,C,H,W)(N, C, H, W) (same shape as input)

Examples

if (torch_is_installed()) { m <- nn_softmax2d() input <- torch_randn(2, 3, 12, 13) output <- m(input) }
  • Maintainer: Daniel Falbel
  • License: MIT + file LICENSE
  • Last published: 2025-02-14