Hi,

Could you please help me to find why following error happens.

When I try to train model I get massage AttributeError: ‘tuple’ object has no attribute ‘log_softmax’

at this line:

loss = criterion(output, target)

And indeed, when I print output, I have tuple like this:

(tensor([[ 0.3656, -0.2767],

…

[ 0.3415, -0.4962]], grad_fn=)

My input is [16,100] when 16 is number of features, 100 is batch size

How can I get rid of tuple?

Below is how my model is defined.

Sorry for my night English.

Thank you very much in advance!

```
N_INPUTS = 16
N_NEURONS = 5
N_OUTPUTS = 2
n_layers=2
drop_prob=0.85
class ImageRNN(nn.Module):
def __init__(self, batch_size, n_inputs, n_neurons,drop_prob, n_outputs,n_layers):
super(ImageRNN, self).__init__()
self.n_neurons = n_neurons#hidden_size
self.batch_size = batch_size
self.n_inputs = n_inputs
self.n_outputs = n_outputs
self.n_layers=n_layers
self.drop_prob = drop_prob
self.lstm = nn.LSTM(self.n_inputs, self.n_neurons, self.n_layers,
dropout=drop_prob, batch_first=False)
self.dropout = nn.Dropout(drop_prob)
self.FC = nn.Linear(self.n_neurons, self.n_outputs)
def init_hidden(self):
weight = next(self.parameters()).data
hidden = (weight.new(self.n_layers, self.batch_size, self.n_neurons).zero_(),
weight.new(self.n_layers, self.batch_size, self.n_neurons).zero_())
return hidden
def forward(self, X):
X = X.unsqueeze(dim=0)
self.hidden = self.init_hidden()
r_output, hidden = self.lstm(X, self.hidden)
out = self.dropout(r_output)
out = self.FC(out)
out=out.view(-1, self.n_outputs)
return out, self.hidden
```

model = ImageRNN(batch_size, N_INPUTS, N_NEURONS, drop_prob, N_OUTPUTS,n_layers)

print(model)