Skip to content

Instantly share code, notes, and snippets.

@DicksonWu654
Created January 17, 2021 21:04
Show Gist options
  • Save DicksonWu654/2596c1c5218663e211e64ebd2cf32339 to your computer and use it in GitHub Desktop.
Save DicksonWu654/2596c1c5218663e211e64ebd2cf32339 to your computer and use it in GitHub Desktop.
Iterators
train_iter = BucketIterator(train_thing, batch_size=bs, sort_key=lambda x: len(x.sequence),
device=device, sort=True, sort_within_batch=True)
valid_iter = BucketIterator(valid_thing, batch_size=bs, sort_key=lambda x: len(x.sequence),
device=device, sort=True, sort_within_batch=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment