I am so sorry that I come across a new problem.Need your help.
I changed as following:
indices = indices.to(decoder_output.device)
probabilities = probabilities.to(inputs.device)

then, the coding runs.  However I found that only gpu0’s GPU-Util is not zero.the others Memory-Usage is not zero but  GPU-Util is zero.
so the data is copied  in different gpus but the model is not? is there any order that can help me find if the model id copied already.
some details:
1)I set the  device = torch.device('cuda:0') in the head of code.
2)I set the nn.Dataparallel like this,
actor = Generator(SOS,EOU, VOCAB_SIZE, GEN_HIDDEN_DIM, GEN_EMBEDDING_DIM,\
            MAX_SEQ_LEN)
actor = (nn.DataParallel(actor)).to(device)

then I use   Generator.module.sample(context,reply, TF=TF)（sample is common seq2seq model）to get my results.
3)When i run the code I give the order"CUDA_VISIBLE_DEVICES=0,1,2,3 python main.py"