Hello,
so i changed some code in the script and get the following error:
RuntimeError: only batches of spatial targets supported (3D tensors) but got targets of dimension: 4

however my training script is like this (the rest is unchanged):
for epoch in range(20):
    print(epoch)
    VRN.train()
    predicted_model = VRN(inp)[-1].cpu()
    optimizer.zero_grad()
    print(predicted_model.shape)
    print(voxel_array.shape)
    loss = lossfct(predicted_model, voxel_array.squeeze(1))
    print(loss)
    loss.backward()
    optimizer.step()

the print from the shapes says both are the same shape such as
torch.Size([1, 384, 384, 384])

however i understand that pytorch needs it too be [384,384,384]
i change the code too
 loss = lossfct(predicted_model.squeeze(0), voxel_array.squeeze(0))

so that we loose the 1 dimension. However this leads too
ValueError: Expected target size (384, 384), got torch.Size([384, 384, 384])

which i dont understand because in any combination the function does not work.
It basically should just compute the difference between the amount of the 1 in the arrays, i think.
And by minimising this, the CNN gets better in predicting the real Voxel-Volume.
Or am i wrong here?