Last active
September 10, 2018 20:04
-
-
Save mrdrozdov/229996423c7329d94fb22e14377855dc to your computer and use it in GitHub Desktop.
multi-fail.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import numpy as np | |
class Model(torch.nn.Module): | |
def forward(self, x): | |
return torch.from_numpy(x).float().cuda() | |
ngpus = 2 | |
x = np.ones((10, 10)) | |
m = Model() | |
m.cuda() | |
out = torch.nn.parallel.data_parallel(m, x, range(ngpus)) | |
print(x.shape) # (10, 10) | |
print(out.shape) # (20, 10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment