Sure, if it’s not possible we might also debug it without the actual code.
I just wanted to make sure you are using something like this:
model = MyModel()
model = nn.DataParallel(model, device_ids=[0, 1])
model = model.to('cuda:0')  # assignment not necessarily needed here

for data, target in loader:
    data, target = data.to('cuda:0'), target.to('cuda:0')
    optimizer.zero_grad()
    output = model(data)
    ...

Also, no data is needed if that would be an issue as we can just use random inputs.