(msg, eos=False)
| 24 | |
| 25 | # Sting to char tensor |
| 26 | def str2tensor(msg, eos=False): |
| 27 | tensor = [ord(c) for c in msg] |
| 28 | if eos: |
| 29 | tensor.append(EOS_token) |
| 30 | |
| 31 | return cuda_variable(torch.LongTensor(tensor)) |
| 32 | |
| 33 | |
| 34 | # To demonstrate seq2seq, We don't handle batch in the code, |