total_preds = []
for model in models :
    dataloader = DataLoader(test_data,batch_size=1,shuffle=False,num_workers=2)
    preds = []
    temp = []
    i = 0
    for batch in dataloader :
        inputs = batch['input_features'].float()
        with torch.no_grad() :
            p = model(inputs)
            preds.append(torch.squeeze(p))
    
    total_preds.append(preds)

im using kfold cross validation so i have multiple models and i need to average out the predictions of every model.
In the code above preds if of dimension (730,3) and total_preds is the list of all predictions in every fold. I want to retain the dimensions after averaging.
How do i go about it without using any extra loop?