From f65cd37a63ab589a69284468c24a4ca9b7dc8274 Mon Sep 17 00:00:00 2001 From: whs Date: Sat, 6 Feb 2021 15:32:06 +0800 Subject: [PATCH] Fix print for py2 (#662) --- demo/dygraph/pruning/eval.py | 2 +- demo/dygraph/pruning/export_model.py | 2 +- demo/dygraph/pruning/train.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/demo/dygraph/pruning/eval.py b/demo/dygraph/pruning/eval.py index 37024f35..48682074 100644 --- a/demo/dygraph/pruning/eval.py +++ b/demo/dygraph/pruning/eval.py @@ -105,7 +105,7 @@ def eval(args): ratios = {} for param in params: ratios[param] = args.pruned_ratio - print(f"ratios: {ratios}") + print("ratios: {}".format(ratios)) pruner.prune_vars(ratios, [0]) model = paddle.Model(net, inputs, labels) diff --git a/demo/dygraph/pruning/export_model.py b/demo/dygraph/pruning/export_model.py index 99f6afdb..2724276c 100644 --- a/demo/dygraph/pruning/export_model.py +++ b/demo/dygraph/pruning/export_model.py @@ -86,7 +86,7 @@ def export(args): ratios = {} for param in params: ratios[param] = args.pruned_ratio - print(f"ratios: {ratios}") + print("ratios: {}".format(ratios)) pruner.prune_vars(ratios, [0]) param_state_dict = paddle.load(args.checkpoint + ".pdparams") diff --git a/demo/dygraph/pruning/train.py b/demo/dygraph/pruning/train.py index 64a93666..70ad3dda 100644 --- a/demo/dygraph/pruning/train.py +++ b/demo/dygraph/pruning/train.py @@ -171,7 +171,7 @@ def compress(args): for param in net.parameters(): if "conv2d" in param.name: - print(f"{param.name}\t{param.shape}") + print("{}\t{}".format(param.name, param.shape)) net.train() model = paddle.Model(net, inputs, labels) -- GitLab