未验证 提交 b0630913 编写于 作者: S ShawnXuan 提交者: GitHub

Merge pull request #135 from Oneflow-Inc/loss_reduce_mean_fp16

don't use reduce mean in fp16
......@@ -86,7 +86,8 @@ def TrainNet():
else:
loss = flow.nn.sparse_softmax_cross_entropy_with_logits(labels, logits, name="softmax_loss")
loss = flow.math.reduce_mean(loss)
if not args.use_fp16:
loss = flow.math.reduce_mean(loss)
flow.losses.add_loss(loss)
predictions = flow.nn.softmax(logits)
outputs = {"loss": loss, "predictions": predictions, "labels": labels}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册