Guest User

Untitled

a guest
Feb 15th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. for _ in range(100):
  2. ix = torch.tensor([[choice]]).to(device)
  3. output, (state_h, state_c) = net(ix, (state_h, state_c))
  4.  
  5. _, top_ix = torch.topk(output[0], k=top_k)
  6. choices = top_ix.tolist()
  7. choice = np.random.choice(choices[0])
  8. words.append(int_to_vocab[choice])
  9.  
  10. print(' '.join(words))
Add Comment
Please, Sign In to add comment