diff --git a/demo/darts/train_imagenet.py b/demo/darts/train_imagenet.py index 2bbf738ccc8c27395dfe228f30d157fe3115efe7..09a90a96ba02173fba695aef030e04c88af6f5f9 100644 --- a/demo/darts/train_imagenet.py +++ b/demo/darts/train_imagenet.py @@ -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): 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_one_hot, epsilon=epsilon, dtype="float32") loss = fluid.layers.cross_entropy( diff --git a/demo/models/slimfacenet.py b/demo/models/slimfacenet.py index 6a1c0a7dcdb176a779b66658cdfe9c3be1eba80d..33a4deab9340855398c9c9e7d0aa4386a6377030 100644 --- a/demo/models/slimfacenet.py +++ b/demo/models/slimfacenet.py @@ -334,7 +334,7 @@ class SlimFaceNet(): else: 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( one_hot, phi) + fluid.layers.elementwise_mul( (1.0 - one_hot), cosine) diff --git a/paddleslim/models/slimfacenet.py b/paddleslim/models/slimfacenet.py index 95b445fcd65b6fdfd0a7a4e991f3a18496b1807a..5276a515c2d08e78360eae1ccab01471fb46f5ed 100644 --- a/paddleslim/models/slimfacenet.py +++ b/paddleslim/models/slimfacenet.py @@ -334,7 +334,7 @@ class SlimFaceNet(): else: 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( one_hot, phi) + fluid.layers.elementwise_mul( (1.0 - one_hot), cosine)