It seems that if I only specify one GPU, even if I use nn.DataParallel, for example, as the following
model = nn.DataParallel(model, device_ids=[0])

the result will be correct. But if I use more than one, say
model = nn.DataParallel(model, device_ids=[0, 1])

the result will make no sense.