Skip to content

Instantly share code, notes, and snippets.

@williamFalcon
Created July 29, 2019 17:49
Show Gist options
  • Save williamFalcon/65ef3a6017bdcd469838f94bbc8e7dc9 to your computer and use it in GitHub Desktop.
Save williamFalcon/65ef3a6017bdcd469838f94bbc8e7dc9 to your computer and use it in GitHub Desktop.
# copy model on each GPU and give a fourth of the batch to each
model = DataParallel(model, devices=[0, 1, 2 ,3])
# out has 4 outputs (one for each gpu)
out = model(x.cuda(0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment