From f97603f0aa510713e879d0dd651ac97946636d60 Mon Sep 17 00:00:00 2001 From: minghaoBD <79566150+minghaoBD@users.noreply.github.com> Date: Fri, 16 Jul 2021 17:25:16 +0800 Subject: [PATCH] fix illegal usage: paddle.static.CPUPlace() (#852) (#853) --- paddleslim/prune/unstructured_pruner.py | 2 +- tests/test_quant_aware.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/paddleslim/prune/unstructured_pruner.py b/paddleslim/prune/unstructured_pruner.py index 8c0857df..b8e77c9c 100644 --- a/paddleslim/prune/unstructured_pruner.py +++ b/paddleslim/prune/unstructured_pruner.py @@ -35,7 +35,7 @@ class UnstructuredPruner(): 'ratio', 'threshold' ], "mode must be selected from 'ratio' and 'threshold'" self.scope = paddle.static.global_scope() if scope == None else scope - self.place = paddle.static.CPUPlace() if place is None else place + self.place = paddle.CPUPlace() if place is None else place if skip_params_func is None: skip_params_func = self._get_skip_params self.skip_params = skip_params_func(program) self.masks = self._apply_masks(program) diff --git a/tests/test_quant_aware.py b/tests/test_quant_aware.py index a587c769..8cd9e3bc 100644 --- a/tests/test_quant_aware.py +++ b/tests/test_quant_aware.py @@ -108,7 +108,7 @@ class TestQuantAwareCase2(StaticCase): val_prog = main_prog.clone(for_test=True) place = paddle.CUDAPlace(0) if paddle.is_compiled_with_cuda( - ) else paddle.static.CPUPlace() + ) else paddle.CPUPlace() exe = paddle.static.Executor(place) exe.run(paddle.static.default_startup_program()) -- GitLab