Using torch.cat on list of tensors
I have a list of torch tensors
list_tensor = [tensor([[1, 2, 3],
                       [3, 4, 5]]), 
               tensor([[4, 5, 6],
                       [6, 4, 3]]), 
               tensor([[4, 2, 1],
                       [3, 3, 1]]), 
               tensor([[1, 4, 5],
                       [3, 1, 0]]), 
               tensor([[1, 3, 3],
                       [2, 2, 2]])]

I want to do a cross validation on this set, so I want to consider four tensors as training, and keep 1 for testing - and I want to do this for len(list_tensor) times.
So I thought of doing,
for num in range(1, len(list_tensor) + 1):
       train_x = torch.cat((list_tensor[:num], list_tensor[num:]))

The problem is I cannot use lists for a torch.cat operation because both  list_tensor[:num] and  list_tensor[num:] return lists. For example, for num = 1,
list_tensor[:num] = [tensor([[1, 2, 3], [3, 4, 5]])]
list_tensor[num:] = [tensor([[4, 5, 6], [6, 4, 3]]), tensor([[4, 2, 1],[3, 3, 1]]), tensor([[1, 4, 5], 
                      [3, 1, 0]]), tensor([[1, 3, 3], [2, 2, 2]])]

How do I perform torch.cat on this?

I found a work around without using reduce.
train_x = torch.cat((torch.cat(list_tensor[:num+1]),torch.cat(list_tensor[num+1:])))
Basically concatenate all tensors in the individual list, this returns a torch.tensor object, then use torch.cat on both.
