Hi @ptrblck
How do I run the equality test in my case?
The output from network is of size output = np.array(output) #(12,10,32,32,32)
and the final image size after the code is (1,160,192,128)
The example you gave takes an image, breaks it down and then reconstructs it back.
In my case the image shape changes in the test_loader from (1,172,220,156) to (10,1,32,32,32)
Please see the codes below for detail(I mentioned the shapes as comments)
    for i in filenames_test: #filenames_test consists a single 172,220,156 shaped image
        path_mr = os.path.join(dir_test, 'MR', i)
        MR = nib.load(path_mr).get_data()
        path_ct = os.path.join(dir_test, 'CT', i)
        CT = nib.load(path_ct).get_data() 
        X = get_nonoverlapping_patch(MR,patch_size) # torch.Size([120,32,32,32])
        y = get_nonoverlapping_patch(CT,patch_size)
        #get_nonoverlapping_patch creates the patches, before the reshape section
        patches_MR.append(X)
        patches_CT.append(y)

    print(i,X.shape,y.shape) #(120, 32, 32, 32)

    test_dataset = Dataset(patches_MR, patches_CT)
    test_loader = data.DataLoader(test_dataset, batch_size=10, shuffle=False)

    for i,sample in enumerate(test_loader):
        with torch.no_grad():
            mr = sample[0].float().to(device)
            ct = sample[1].float().to(device)
            pred = model(mr)
            CT_synth = pred.detach().cpu().numpy().squeeze(1)
            CT_sq = ct.detach().cpu().numpy().squeeze(1)
            output.append(CT_synth)

    """Now recontruct the output"""
    output = np.array(output) #(12,10,32,32,32)
    output = output.reshape(-1,32,32,32) #(120,32,32,32)

    output = torch.tensor(output)
    output = output.unsqueeze(0) #(1,120,32,32,32)
    unfold_shape = [1, 172 // 32, 220 // 32, 156 // 32, 32, 32, 32]

    output_c = unfold_shape[1] * unfold_shape[4] #corresponding number of blocks x patch dimension
    output_h = unfold_shape[2] * unfold_shape[5]
    output_w = unfold_shape[3] * unfold_shape[6]

    Orig = output.view(unfold_shape)  # torch.Size([1, 5, 6, 4, 32, 32, 32])
    Orig1 = Orig.permute(0, 1, 4, 2, 5, 3, 6).contiguous() #torch.Size([1, 5, 32, 6, 32, 4, 32])
    Orig2 = Orig1.view(1, output_c, output_h, output_w) #torch.Size([1, 160, 192, 128])

    Orig3 = Orig2.squeeze(0) #torch.Size([160, 192, 128])
    Orig4 = np.array(Orig3) #numpy.ndarray