首先,先看官方定义

dim: A dimension along which Softmax will be computed (so every slice along dim will sum to 1)

具体解释为:
当 dim=0 时,是对每一维度相同位置的数值进行softmax运算;
当 dim=1 时,是对某一维度的列进行softmax运算;
当 dim=2 或 -1 时,是对某一维度的行进行softmax运算;

pytorch softmax 中参数 dim 的理解

Ref
pytorch中tf.nn.functional.softmax(x,dim = -1)对参数dim的理解

相关文章:

  • 2021-11-09
  • 2022-12-23
  • 2022-01-24
  • 2022-12-23
  • 2022-12-23
  • 2021-10-10
  • 2022-12-23
  • 2021-06-04
猜你喜欢
  • 2021-09-07
  • 2022-12-23
  • 2022-03-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-09
相关资源
相似解决方案