Guest User

Untitled

a guest
May 25th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. # batch_size = 32: In each batch contains 32 instaces. # batch
  2. # It has been proved that training in a batch gives better performance than learn a single data at a time
  3. # device = torch.device("cuda"): Use GPU. If you do not have a GPU enviornment, use torch.device("cpu") instead
  4. # repeat = False: Do not repeat the iterator for multiple epochs
  5. # sort_key = lambda...: A key to use for sorting examples in order to batch together examples with similar lengths
  6. # and minimize padding. The sort_key provided to the Iterator constructor overrides the sort_key attribute of
  7. # the Dataset, or defers to it if None
  8. train_iter, test_iter = data.BucketIterator.splits(
  9. (train, test), batch_size=32, device=torch.device("cuda"), repeat=False, sort_key=lambda x: len(x.Text))
Add Comment
Please, Sign In to add comment