Skip to content

Instantly share code, notes, and snippets.

@williamFalcon
Created July 29, 2019 17:50
Show Gist options
  • Save williamFalcon/296fa0b0605c7e6052d74f89a7d39d68 to your computer and use it in GitHub Desktop.
Save williamFalcon/296fa0b0605c7e6052d74f89a7d39d68 to your computer and use it in GitHub Desktop.
# each model is sooo big we can't fit both in memory
encoder_rnn.cuda(0)
decoder_rnn.cuda(1)
# run input through encoder on GPU 0
encoder_out = encoder_rnn(x.cuda(0))
# run output through decoder on the next GPU
out = decoder_rnn(encoder_out.cuda(1))
# normally we want to bring all outputs back to GPU 0
out = out.cuda(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment