摘要: 使用交叉熵损失的网络模型最后一层不要用softmax,交叉熵损失函数会在计算的时候做softmax,如果用了会导致模型训练异常, 如果模型最后一层有softmax,则损失函数要写成 loss_fun = nn.NLLLoss() x = model(data) loss = loss_fun(tor 阅读全文
posted @ 2023-06-25 10:44 Liang-ml 阅读(39) 评论(0) 推荐(0)