RuntimeError: one_hot is only applicable to index tensor
RuntimeError: one_hot is only applicable to index tensor.
·
源代码:
dice_target = nn.functional.one_hot(dice_target, num_classes).float()
解决:
dice_target.to(torch.int64)
修改后的代码:
dice_target = nn.functional.one_hot(dice_target.to(torch.int64), num_classes).float()
亲测有效
原文链接在此
更多推荐
已为社区贡献9条内容
所有评论(0)