From c92b78b06096ce68b9fe853926af2e3f22a96341 Mon Sep 17 00:00:00 2001 From: whs Date: Thu, 1 Aug 2019 10:26:39 +0800 Subject: [PATCH] Fix unitest of light nas. (#18931) test=develop --- .../fluid/contrib/slim/nas/light_nas_strategy.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/python/paddle/fluid/contrib/slim/nas/light_nas_strategy.py b/python/paddle/fluid/contrib/slim/nas/light_nas_strategy.py index 7f44510bd5..380c93d881 100644 --- a/python/paddle/fluid/contrib/slim/nas/light_nas_strategy.py +++ b/python/paddle/fluid/contrib/slim/nas/light_nas_strategy.py @@ -82,15 +82,7 @@ class LightNASStrategy(Strategy): self._server_ip = self._get_host_ip() def _get_host_ip(self): - - try: - s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - s.connect(('8.8.8.8', 80)) - ip = s.getsockname()[0] - finally: - s.close() - - return ip + return socket.gethostbyname(socket.gethostname()) def on_compression_begin(self, context): self._current_tokens = context.search_space.init_tokens() -- GitLab