When I print the data in train_iter, the output as follow:

image1052×590 35 KB

As i say at the beginning, I think the last element of src and trg should be <eos> token, which is 3, but in fact the last element of src and trg is 1, that is <pad> token.