hfslyc / AdvSemiSeg

Adversarial Learning for Semi-supervised Semantic Segmentation, BMVC 2018
504 stars 129 forks source link

IndexError: too many indices for array: array is 0-dimensional, but 1 were indexed #57

Open yzj0531 opened 3 years ago

yzj0531 commented 3 years ago

File "train.py", line 355, in main loss_semi_adv_value += loss_semi_adv.data.cpu().numpy()[0]/args.lambda_semi_adv IndexError: too many indices for array: array is 0-dimensional, but 1 were indexed

i need help, thanks!

yeeyangtee commented 3 years ago

you can try: loss_semi_adv_value += loss_semi_adv.data.cpu().numpy().item()/args.lambda_semi_adv

For newer version of PyTorch, this is better: loss_semi_adv_value += loss_semi_adv.item()/args.lambda_semi_adv