Thank you very much for your help, @ptrblck.
I saved predictions, targets, indices in the lists. I used for loops to find equal indices and their corresponding predictions, but it is so slow, I wonder is there any ways to speed up finding equal indices?
for i in range(len(prediction_test)):
    idx = idx_test[i]                   #idx:torch.Size([64])
    target1 = target_test[i]            #target1:torch.Size([64])
    prediction1 = prediction_test[i]    #prediction1:torch.Size([64, 10])
                    
                    
    for j in range(len(idx)):
        idx1 = idx[j]         
                        
        for m in range(len(prediction_test)):
            idx2 = idx_testsh[m]
            prediction2 = prediction_testsh[m]
            for n in range(len(idx2)):
                if idx2[n] == idx1:
                    prediction22 = prediction2[n,:]
                    break

        target = target1[j]      
        prediction11 = prediction1[j,:]