!5501 Fix: Tensor(0) is surprisingly to be falsy, which leads to loss not be recorded

Merge pull request !5501 from LiHongzhang/loss_tensor
This commit is contained in:
mindspore-ci-bot 2020-08-30 09:52:54 +08:00 committed by Gitee
commit fdbd4cd4d1
1 changed files with 1 additions and 1 deletions

View File

@ -602,7 +602,7 @@ class SummaryCollector(Callback):
return
train_lineage = {}
loss = self._get_loss(cb_params)
if loss:
if loss is not None:
loss_numpy = loss.asnumpy()
loss = float(np.atleast_1d(loss_numpy)[0])
train_lineage[LineageMetadata.loss] = loss