Target size [16] must be the same as input size [16, 1] 报错二分类标签对齐方案

这个报错是 PyTorch 训练二分类模型时非常高频的张量形状不匹配问题,报错含义是损失函数拿到的预测输出 shape 是 [16,1],标签 targ