Progressive-Generative-Networks icon indicating copy to clipboard operation
Progressive-Generative-Networks copied to clipboard

when i run the gan_lstm.py an error happened

Open Lvhhhh opened this issue 6 years ago • 2 comments

gan_lstm.py:89: UserWarning: nn.init.kaiming_normal is now deprecated in favor of nn.init.kaiming_normal_. nn.init.kaiming_normal(m.weight.data, mode='fan_out') gan_lstm.py:217: UserWarning: nn.init.kaiming_normal is now deprecated in favor of nn.init.kaiming_normal_. nn.init.kaiming_normal(m.weight.data, mode='fan_out') <main.ParisData object at 0x7f6c003cc090> /usr/local/lib/python2.7/dist-packages/skimage/transform/_warps.py:84: UserWarning: The default mode, 'constant', will be changed to 'reflect' in skimage 0.15. warn("The default mode, 'constant', will be changed to 'reflect' in " /usr/local/lib/python2.7/dist-packages/skimage/transform/_warps.py:84: UserWarning: The default mode, 'constant', will be changed to 'reflect' in skimage 0.15. warn("The default mode, 'constant', will be changed to 'reflect' in " /usr/local/lib/python2.7/dist-packages/torch/nn/functional.py:1332: UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead. warnings.warn("nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.") Traceback (most recent call last): File "gan_lstm.py", line 583, in main() File "gan_lstm.py", line 490, in main D_cost = fake_loss_48.data[0] + fake_loss_32.data[0] + fake_loss_16.data[0] + fake_loss_0.data[0] IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

Lvhhhh avatar Jan 14 '19 09:01 Lvhhhh

So basically you have to use .item() as follows instead of using .data[0]. This is actually for new version of torch. D_cost = fake_loss_48.item() + fake_loss_32.item() + fake_loss_16.item() + fake_loss_0.item()

sohelmsc avatar Jan 14 '19 15:01 sohelmsc

老哥,你用的数据集是巴黎街道吗,是自己把它crop成了128X128? 我也是这个问题

zhangbaijin avatar Jul 24 '19 07:07 zhangbaijin