I am also getting the same problem while prediction.  Could you please help:
test_dl = DataLoader(tst_data, batch_size=64, shuffle=False)
test = []
print(‘Predicting on test dataset’)
for batch, _ in tst_data:
#test_dl:
#batch = batch.permute(0, 2, 1)
batch=batch.to(device)
print(batch.shape)
out = model.to(device)
y_hat = F.log_softmax(out, dim=1).argmax(dim=1) ### at this line I am receiving an error.
test += y_hat.tolist()

class LSTMClassifier(nn.Module):
def __init__(self, input_dim, hidden_dim, layer_dim, output_dim):
    super().__init__()
    self.hidden_dim = hidden_dim
    self.layer_dim = layer_dim
    self.lstm = nn.LSTM(input_dim, hidden_dim, layer_dim, batch_first=True)
    self.fc = nn.Linear(hidden_dim, output_dim)
    self.batch_size = None
    self.hidden = None
  

def forward(self, x):
    h0, c0 = self.init_hidden(x)
   
    print(x.size())
    out, (hn, cn) = self.lstm(x, (h0, c0))
    out = self.fc(out[:, -1, :])
    return out

def init_hidden(self, x):
    h0 = torch.zeros(self.layer_dim, x.size(0), self.hidden_dim)
    c0 = torch.zeros(self.layer_dim, x.size(0), self.hidden_dim)

    print(h0.shape)
    print(x.size(0))
    print(layer_dim)
    return [t.to(device) for t in (h0, c0)]

Thank you in advance!
Error :: AttributeError: ‘LSTMClassifier’ object has no attribute ‘log_softmax’