The error of log_softmax

output = F.log_softmax(self.out(torch.cat((rnn_output, context), 2)), dim=1)
TypeError: log_softmax() got an unexpected keyword argument 'dim'

The doc is:

Parameters:	
input (Variable) – input
dim (int) – A dimension along which log_softmax will be computed.

The error of getting an unexpected keyword argument ‘dim’ is weird.

what is the reason of it?

Please check your Pytorch version. log_softmax() only had one argument in version 0.1.12.

>>> import torch
>>> torch.__version__
'0.2.0_3'

It’s not 0.1.12

It seems that this change hasn’t got released.
Please refer to this link: https://github.com/pytorch/pytorch/issues/3235

1 Like

It seems that.Thanks!