Change the call to include dim=X as an argument in softmax function

(Søren Koch) #1

Hello there,

Im running the latest pytorch and i cannot specify a X dimension for the softmax to run in.

I have the line:

probs = F.softmax(outputs * self.T)   

Then i get the warning

 UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
  probs = F.softmax(outputs * self.T)

then i of cause add

probs = F.softmax(outputs * self.T,dim=X)   

but then i get the error

NameError: name 'X' is not defined

help help, because this does not make sense to me… :slight_smile:

(jpeg729) #2

Your code was working before you added ‘dim=X’, the error message was only a warning.
If you want to add dim=something then something must be a number instead of ‘X’.
The number will correspond to the dimension over which the softmax is to be performed.