From cc1cd6f41f7da2b8c8acf1b797c27825449da31f Mon Sep 17 00:00:00 2001 From: ceci3 Date: Thu, 2 Jan 2020 16:40:27 +0800 Subject: [PATCH] fix nas in python3 (#21) * fix py3 * fix --- paddleslim/common/sa_controller.py | 2 +- paddleslim/nas/sa_nas.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/paddleslim/common/sa_controller.py b/paddleslim/common/sa_controller.py index 8a081761..c49adb77 100644 --- a/paddleslim/common/sa_controller.py +++ b/paddleslim/common/sa_controller.py @@ -137,7 +137,7 @@ class SAController(EvolutionaryController): _logger.debug("change index[{}] from {} to {}".format( index, tokens[index], new_tokens[index])) - if self._searched.has_key(str(new_tokens)): + if str(new_tokens) in self._searched.keys(): _logger.debug('get next tokens including searched tokens: {}'. format(new_tokens)) continue diff --git a/paddleslim/nas/sa_nas.py b/paddleslim/nas/sa_nas.py index 428385f5..73a8ecf6 100644 --- a/paddleslim/nas/sa_nas.py +++ b/paddleslim/nas/sa_nas.py @@ -93,7 +93,7 @@ class SANAS(object): premax_reward = scene['_max_reward'] prebest_tokens = scene['_best_tokens'] preiter = scene['_iter'] - psearched = screen['_searched'] + psearched = scene['_searched'] else: preinit_tokens = init_tokens prereward = -1 @@ -114,7 +114,7 @@ class SANAS(object): best_tokens=prebest_tokens, constrain_func=None, checkpoints=save_checkpoint, - searched = psearched) + searched=psearched) max_client_num = 100 self._controller_server = ControllerServer( -- GitLab