Dear friends,
I use BucketIterator to generate vector  as below:

train_iterator, valid_iterator, test_iterator = BucketIterator.splits(
(train_data, valid_data, test_data), sort_key=lambda x: len(x.src),
batch_size = BATCH_SIZE,
device = device)

successfully, I get ( train_iterator, valid_iterator, test_iterator), and I can access each vector as :

Get_vector_row = next(iter(train_iterator))


vars(Get_vector_row).keys()

dict_keys([‘batch_size’, ‘dataset’, ‘fields’, ‘input_fields’, ‘target_fields’, ‘src’, ‘trg’])

Get_vector_row.src[0:]


tensor([[   2,  293, 1674,  …,    1,    1,    1],
[   2,  720, 2373,  …,    1,    1,    1],
[   2,  114, 6271,  …,    1,    1,    1],
…,
[   2,  135, 5987,  …, 2345,    4,    3],
[   2,   26, 1306,  …,    1,    1,    1],
[   2, 1186, 1780,  …,    1,    1,    1]], device=‘cuda:0’)

My question is how to convert the tensor in the previous line back to words?