【error】Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X

报错信息:

Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.

错误行数:

softmax = F.softmax(enout_att.squeeze(2)) 

回想:

错误发生在我更新了pytorch版本0.1更新到0.3,应该是由此出现了错误。

错误信息:

Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument. 

对于softmax的隐式维度选择已经被弃用。更改调用包含dim = X作为参数。

我的原代码:  

 softmax = F.softmax(enout_att.squeeze(2)) 

更改为: 

 softmax = F.softmax(enout_att.squeeze(2), dim=1) 

错误解决。 

你可能感兴趣的:(随记)