Patch masked_lm memory leak on GPUs (#1195)
Patch masked_lm memory leak on GPUs (#1195)

Summary:
# Before submitting

- [x] Was this discussed/approved via a Github issue? (no need for typos, doc improvements)
- [x] Did you read the [contributor guideline](https://github.com/pytorch/fairseq/blob/master/CONTRIBUTING.md)?
- [x] Did you make sure to update the docs?
- [x] Did you write any new necessary tests?

## What does this PR do?
Fixes memory leak in masked_lm criterion.

## PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

## Did you have fun?
Make sure you had fun coding �
Pull Request resolved: https://github.com/fairinternal/fairseq-py/pull/1195

Reviewed By: myleott

Differential Revision: D22155285

Pulled By: joshim5

fbshipit-source-id: 9414e307e1e2d2a9225884dc94aae964a1627682

pytorch/fairseq,pytorch/fairseq,pytorch/fairseq