File "/content/StackGAN-v2-rev/code/trainer.py", line 613, in train_Dnet
summary_D = summary.scalar('D_loss%d' % idx, errD.data[0])
IndexError: invalid index of a 0-dim tensor. Use tensor.item() in Python or tensor.item<T>() in C++ to convert a 0-dim tensor to a number
==> That's because in PyTorch>=0.5, the index of 0-dim tensor is invalid. The master branch is designed for PyTorch 0.4.1, loss_val.data[0] works well.
File "/content/StackGAN-v2-rev/code/trainer.py", line 613, in train_Dnet summary_D = summary.scalar('D_loss%d' % idx, errD.data[0]) IndexError: invalid index of a 0-dim tensor. Use
tensor.item()
in Python ortensor.item<T>()
in C++ to convert a 0-dim tensor to a number==> That's because in PyTorch>=0.5, the index of 0-dim tensor is invalid. The master branch is designed for PyTorch 0.4.1, loss_val.data[0] works well.