As far as i know it’s not possible, what you can do to optimize the memory usage is the following:
target and ground-truth must be in the same gpu.
When you call data parallel you can allocate output and gt to cuda1 and input to cuda1
model=DataParallel(model,output_device=1).cuda()

Here you are calling model in gpu0, but output in gpu1
Now when u allocate input and gt
input=input.cuda(2)
gt=gt.cuda(1)

So output and gt are in the same gpu, and input in a 3rd gpu