AMLab-Amsterdam / AttentionDeepMIL

Implementation of Attention-based Deep Multiple Instance Learning in PyTorch
MIT License
833 stars 189 forks source link

[Fix] fix invalid index of a 0-dim tensor #23

Closed Kaminyou closed 2 years ago

Kaminyou commented 2 years ago

Fix the bug of invalid index of a 0-dim tensor by replacing data[0] to .item(). As:

error = 1. - Y_hat.eq(Y).cpu().float().mean().data[0]

to

error = 1. - Y_hat.eq(Y).cpu().float().mean().data.item()
max-ilse commented 2 years ago

thanks so much for fixing this!