Hypocritical Error Messages Re: Softmax

Running PyTorch 0.4.1 on Ubuntu 16.04

Trying to run a network, and get the following warning message:

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

Add the dim argument to the function then get the following error:

  File "main.py", line 160, in main
    loss = train_epoch(generator, gen_data_iter, gen_criterion, gen_optimizer)
  File "main.py", line 78, in train_epoch
    pred = model.forward(data_var)
  File "/home/bgenchel/SeqGAN/Curious-Musical-SeqGAN/src/models/baseline/generator.py", line 46, in forward
    ped = self.softmax(fc_out, dim=2)
  File "/home/bgenchel/anaconda3/envs/rl4mg/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
TypeError: forward() got an unexpected keyword argument 'dim'

Why is this happening?

Pass the dim argument to the constructor of the class: self.softmax = nn.Softmax(dim=1).


yep this is it. Thanks!