Skip to content

Instantly share code, notes, and snippets.

@shubhamagarwal92
Last active November 14, 2019 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shubhamagarwal92/8ecf839cf70c4990e3540d0bb4f288ff to your computer and use it in GitHub Desktop.
Save shubhamagarwal92/8ecf839cf70c4990e3540d0bb4f288ff to your computer and use it in GitHub Desktop.
Pytorch issue allocating memory on gpu0
# Thanks to https://github.com/andreavanzo for figuring this out
# device should be integer here and not torch.device
# do
torch.cuda.set_device(device)
# before
torch.cuda.empty_cache()
# Also do empty cache after every epoch
# Detach vs no grad
# https://discuss.pytorch.org/t/detach-no-grad-and-requires-grad/16915/8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment