未验证 提交 567e90e4 编写于 作者: W whs 提交者: GitHub

Rename fluid.layers.one_hot to fluid.one_hot (#292)

上级 b3e4cbeb
...@@ -68,7 +68,7 @@ add_arg('use_data_parallel', ast.literal_eval, False, "The flag indicating whet ...@@ -68,7 +68,7 @@ add_arg('use_data_parallel', ast.literal_eval, False, "The flag indicating whet
def cross_entropy_label_smooth(preds, targets, epsilon): def cross_entropy_label_smooth(preds, targets, epsilon):
preds = fluid.layers.softmax(preds) preds = fluid.layers.softmax(preds)
targets_one_hot = fluid.layers.one_hot(input=targets, depth=args.class_num) targets_one_hot = fluid.one_hot(input=targets, depth=args.class_num)
targets_smooth = fluid.layers.label_smooth( targets_smooth = fluid.layers.label_smooth(
targets_one_hot, epsilon=epsilon, dtype="float32") targets_one_hot, epsilon=epsilon, dtype="float32")
loss = fluid.layers.cross_entropy( loss = fluid.layers.cross_entropy(
......
...@@ -334,7 +334,7 @@ class SlimFaceNet(): ...@@ -334,7 +334,7 @@ class SlimFaceNet():
else: else:
pass pass
one_hot = fluid.layers.one_hot(input=label, depth=out_dim) one_hot = fluid.one_hot(input=label, depth=out_dim)
output = fluid.layers.elementwise_mul( output = fluid.layers.elementwise_mul(
one_hot, phi) + fluid.layers.elementwise_mul( one_hot, phi) + fluid.layers.elementwise_mul(
(1.0 - one_hot), cosine) (1.0 - one_hot), cosine)
......
...@@ -334,7 +334,7 @@ class SlimFaceNet(): ...@@ -334,7 +334,7 @@ class SlimFaceNet():
else: else:
pass pass
one_hot = fluid.layers.one_hot(input=label, depth=out_dim) one_hot = fluid.one_hot(input=label, depth=out_dim)
output = fluid.layers.elementwise_mul( output = fluid.layers.elementwise_mul(
one_hot, phi) + fluid.layers.elementwise_mul( one_hot, phi) + fluid.layers.elementwise_mul(
(1.0 - one_hot), cosine) (1.0 - one_hot), cosine)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册