// transpose to make S(sequence) x B (batch)
output = classifier(input.t(), seq_lengths)
print(i, output.size())
print(target.size())
pred = output.data.max(1, keepdim=True)[1]
correct += pred.eq(target.data.view_as(pred)).cpu().sum()
After Change
if name:
input, seq_lengths, target = make_variables([name], [])
output = classifier(input, seq_lengths)
pred = output.data.max(1, keepdim=True)[1]
country_id = pred.cpu().numpy()[0][0]
print(name, "is", train_dataset.get_country(country_id))
return
print("evaluating trained model ...")