PyTorch multi-target not supported 报错解决,CrossEntropyLoss 输入 one-hot 标签转为类别索引方案

在 PyTorch 里使用 CrossEntropyLoss 时报错multi-target not supported,最常见原因就是你传进去的标签是 one-hot 编码格式,而