Hi All, I would like to report a strange bug(?) for the version 0.4.0. Basically, I have a network to produce per-voxel segmentation results. While I was using the 0.3.0 version, the network is trained normally (segmentation testing results are good). After I happened to switch to the 0.4.0 with the exact same code (of course same data as input as well), I got empty return values for the loss (cross entropy loss). Main codes are as following:
loss_main = cross_entropy_3d(output, label_batch)
# in 0.3.0, the loss_main returns normally; however in 0.4.0, the loss_main returns nothing.
def cross_entropy_3d(x, y):
n, c, _, _, _ = x.size()
# x_t : (N*X*Y*Z, C)
x_t = torch.transpose(torch.transpose(torch.transpose(x, 1, 2), 2, 3), 3, 4).contiguous().view(-1, c)
y_t = torch.transpose(torch.transpose(torch.transpose(y, 1, 2), 2, 3), 3, 4).contiguous().view(-1).long()
loss = F.cross_entropy(x_t, y_t)
#loss = loss / x_t.size()[0]
return loss