Open skapoor2024 opened 2 months ago
Make sense. This should be 0. But why we encountered no errors when running this code. Maybe earlier version of Pytorch support this summation?
I believe we should make the following changes like
predict = predict.contiguous().view(1,-1)
target = target.contiguous().view(1,-1)
This would make the dim=1 work properly as all the d,h,w will concatenate and the final dim would be (1,dhw)
In the provided loss function
When we flatten the predict and target array why do we try to sum with dim = 1. Shouldn't it be dim = 0. Since there is only one dimension there . Also when predict and target dimensions are sent to the loss function, they are selected from individual batch and individual organ leaving the 3-D image for target and prediction.