提交 2ce4a558 编写于 作者: C chenguowei01

update weighted softmax loss

上级 fdfa761a
......@@ -34,6 +34,7 @@ def softmax_with_loss(logit,
loss, probs = fluid.layers.softmax_with_cross_entropy(
logit, label, ignore_index=ignore_index, return_softmax=True)
else:
label = fluid.layers.squeeze(label, axes=[-1])
label_one_hot = fluid.one_hot(input=label, depth=num_classes)
if isinstance(weight, list):
assert len(
......
......@@ -34,6 +34,7 @@ def softmax_with_loss(logit,
loss, probs = fluid.layers.softmax_with_cross_entropy(
logit, label, ignore_index=ignore_index, return_softmax=True)
else:
label = fluid.layers.squeeze(label, axes=[-1])
label_one_hot = fluid.one_hot(input=label, depth=num_classes)
if isinstance(weight, list):
assert len(
......
......@@ -40,6 +40,7 @@ def softmax_with_loss(logit,
ignore_index=cfg.DATASET.IGNORE_INDEX,
return_softmax=True)
else:
label = fluid.layers.squeeze(label, axes=[-1])
label_one_hot = fluid.one_hot(input=label, depth=num_classes)
if isinstance(weight, list):
assert len(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册