Commit 57a81ade authored by Yuxin Wu's avatar Yuxin Wu

Avoid import matplotlib and sklearn at first (#363)

parent 02ef551b
......@@ -5,9 +5,9 @@
from tensorpack.libinfo import __version__
from tensorpack.utils import *
from tensorpack.models import *
from tensorpack.dataflow import *
from tensorpack.utils import *
from tensorpack.callbacks import *
from tensorpack.tfutils import *
......
......@@ -235,6 +235,7 @@ class SVMLightData(RNGDataFlow):
filename (str): input file
shuffle (bool): shuffle the data
"""
import sklearn.datasets # noqa
self.X, self.y = sklearn.datasets.load_svmlight_file(filename)
self.X = np.asarray(self.X.todense())
self.shuffle = shuffle
......@@ -287,11 +288,6 @@ except ImportError:
for klass in ['LMDBData', 'LMDBDataDecoder', 'LMDBDataPoint', 'CaffeLMDB']:
globals()[klass] = create_dummy_class(klass, 'lmdb')
try:
import sklearn.datasets
except ImportError:
SVMLightData = create_dummy_class('SVMLightData', 'sklearn') # noqa
try:
import tensorflow as tf
except ImportError:
......
......@@ -37,5 +37,4 @@ for _, module_name, _ in iter_modules(
continue
if module_name in _TO_IMPORT:
_global_import(module_name)
else:
__all__.append(module_name)
__all__.extend(['logger'])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment