You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 to output_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 be loss_dice.data or loss_dice.item() instead.
Could you please look at these? I think the issues might be caused by the updates in pytorch.
The text was updated successfully, but these errors were encountered:
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 to
output_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 be
loss_dice.data
orloss_dice.item()
instead.Could you please look at these? I think the issues might be caused by the updates in pytorch.
The text was updated successfully, but these errors were encountered: