I want do to something like this:
model1 = torch.nn.DataParallel(Net(), device_ids=[0,1]).cuda()
model2 = torch.nn.DataParallel(Net(), device_ids=[2,3]).cuda()

def task(model, data):
  ...
  return out

out1 = task(model1, data1)
out2 = task(model2, data2)

I want to get out1 out2 in parallel, using torch.multiprocessing will cause error. Any idea on how to do this