From f1b2e3b75f9aee1c16ea7daf2fb25bbf4ba9358e Mon Sep 17 00:00:00 2001 From: whs Date: Fri, 8 May 2020 13:57:52 +0800 Subject: [PATCH] Fix relative import in demo of pruning (#261) --- demo/prune/eval.py | 3 +-- demo/sensitive/train.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/demo/prune/eval.py b/demo/prune/eval.py index 7b914342..0cd2a9dc 100644 --- a/demo/prune/eval.py +++ b/demo/prune/eval.py @@ -8,11 +8,10 @@ import math import time import numpy as np import paddle.fluid as fluid -sys.path.append("../../") from paddleslim.prune import load_model from paddleslim.common import get_logger from paddleslim.analysis import flops -sys.path.append(sys.path[0] + "/../") +sys.path[0] = os.path.join(os.path.dirname("__file__"), os.path.pardir) import models from utility import add_arguments, print_arguments diff --git a/demo/sensitive/train.py b/demo/sensitive/train.py index f0439616..7137b953 100644 --- a/demo/sensitive/train.py +++ b/demo/sensitive/train.py @@ -11,7 +11,7 @@ import paddle.fluid as fluid from paddleslim.prune import merge_sensitive, get_ratios_by_loss from paddleslim.prune import sensitivity from paddleslim.common import get_logger -sys.path.append(sys.path[0] + "/../") +sys.path[0] = os.path.join(os.path.dirname("__file__"), os.path.pardir) import models from utility import add_arguments, print_arguments -- GitLab