From a9ae9555529579d35b2d7d01eb6becc0af423b63 Mon Sep 17 00:00:00 2001 From: LielinJiang Date: Fri, 10 Apr 2020 07:30:41 +0000 Subject: [PATCH] fix PYTHONPATH --- models/mobilenetv1.py | 2 +- tests/test_callbacks.py | 2 ++ tests/test_datasets.py | 4 ++-- tests/test_model.py | 6 +++--- tests/test_progressbar.py | 2 ++ tests/test_transforms.py | 4 ++-- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/models/mobilenetv1.py b/models/mobilenetv1.py index a6c97fa..2ac0408 100644 --- a/models/mobilenetv1.py +++ b/models/mobilenetv1.py @@ -255,7 +255,7 @@ class MobileNetV1(Model): if self.with_pool: y = self.pool2d_avg(y) - if self.num_classes > -1: + if self.num_classes > 0: y = fluid.layers.reshape(y, shape=[-1, 1024]) y = self.out(y) return y diff --git a/tests/test_callbacks.py b/tests/test_callbacks.py index 3528a78..c133f3b 100644 --- a/tests/test_callbacks.py +++ b/tests/test_callbacks.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +# when test, you should add hapi root path to the PYTHONPATH, +# export PYTHONPATH=PATH_TO_HAPI:$PYTHONPATH import unittest import time import random diff --git a/tests/test_datasets.py b/tests/test_datasets.py index 942f2dc..3d32f05 100644 --- a/tests/test_datasets.py +++ b/tests/test_datasets.py @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +# when test, you should add hapi root path to the PYTHONPATH, +# export PYTHONPATH=PATH_TO_HAPI:$PYTHONPATH import unittest -import sys -sys.path.append('..') from datasets.folder import DatasetFolder diff --git a/tests/test_model.py b/tests/test_model.py index 9e8c880..2ac4cbd 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -15,13 +15,13 @@ from __future__ import division from __future__ import print_function +# when test, you should add hapi root path to the PYTHONPATH, +# export PYTHONPATH=PATH_TO_HAPI:$PYTHONPATH + import unittest import os -import sys -sys.path.append('../') - import numpy as np import contextlib diff --git a/tests/test_progressbar.py b/tests/test_progressbar.py index b1f46e2..dd099ca 100644 --- a/tests/test_progressbar.py +++ b/tests/test_progressbar.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +# when test, you should add hapi root path to the PYTHONPATH, +# export PYTHONPATH=PATH_TO_HAPI:$PYTHONPATH import unittest import random import time diff --git a/tests/test_transforms.py b/tests/test_transforms.py index 754430b..fbe0f2c 100644 --- a/tests/test_transforms.py +++ b/tests/test_transforms.py @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +# when test, you should add hapi root path to the PYTHONPATH, +# export PYTHONPATH=PATH_TO_HAPI:$PYTHONPATH import unittest -import sys -sys.path.append('..') from datasets.folder import DatasetFolder from transform import transforms -- GitLab