def label_from_output([output](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor"), output_labels): top_n, top_i = [output](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor").topk(1) label_i = top_i[0].item() return output_labels[label_i], label_i input = lineToTensor('Albert') [output](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor") = rnn(input) #this is equivalent to ``output = rnn.forward(input)`` print([output](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor")) print(label_from_output([output](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor"), alldata.labels_uniq))