Open shem-anton opened 5 years ago
Hi, I am using cuda 10.0 and pytorch 1.0.1 I have the first error, too. And also used squeeze(1) to suppress it. But I did not have the second one.
Thanks for pointing out these issues. I haven't got time to update the code for newer CUDA and pytorch version, but PR is welcomed!
could you please tell your CUDA version and pytorch version
Hi! I tried to reproduced the results with CUDA 9 and pytorch 1.1. I encountered several difficulties that required me to slightly modify code. Namely there are these two problems:
RuntimeError: expand(torch.cuda.FloatTensor{[36, 1, 128, 128]}, size=[36, 128, 128]): the number of sizes provided (3) must be greater or equal to the number of dimensions in the tensor (4) at the lines
output_masked[:,d,:,:] = input_mask[:,d,:,:].unsqueeze(1) * output
target_masked[:,d,:,:] = input_mask[:,d,:,:].unsqueeze(1) * target
I had to change them tooutput_masked[:,d,:,:] = (input_mask[:,d,:,:].unsqueeze(1) * output).squeeze(1)
output_masked[:,d,:,:] = (input_mask[:,d,:,:].unsqueeze(1) * output).squeeze(1)
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number at the lines
print("===> Epoch[{}]({}/{}): Batch Dice: {:.4f}".format(epoch, i, len(dataloader), 1 - loss_dice.data[0]))
print("===> Epoch[{}]({}/{}): G_Loss: {:.4f}".format(epoch, i, len(dataloader), loss_G.data[0]))
print("===> Epoch[{}]({}/{}): D_Loss: {:.4f}".format(epoch, i, len(dataloader), loss_D.data[0]))
I think it should beloss_dice.data
orloss_dice.item()
instead.Could you please look at these? I think the issues might be caused by the updates in pytorch.