Thank you for your reply, @ptrblck.
I got that, but the problem is how I can convert a list of tensors to tensor? I tried
idxt = [*idx_test, *idx_testsh]
index = torch.stack(idxt)

it showed this error, (the last batch has size 16 while the rest are 64)
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 64 and 16 in dimension 1 ...

I also tried
idxt = [*idx_test, *idx_testsh]
i = torch.tensor(idxt)

it gives the error
ValueError: only one element tensors can be converted to Python scalars