Skip to content

Commit 6add179

Browse files
author
Philip Meier
committed
moved import of scipy to make the import of torchvision independent of it
1 parent eb2802e commit 6add179

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

torchvision/datasets/imagenet.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import os
22
import sys
33
import shutil
4-
import scipy.io as sio
54
import torch
65
from .folder import ImageFolder
76
from .utils import check_integrity, download_url
@@ -210,6 +209,8 @@ def parse_devkit(root):
210209

211210
def parse_meta(devkit_root, path='data', filename='meta.mat'):
212211
# FIXME: generalize this for all years
212+
import scipy.io as sio
213+
213214
metafile = os.path.join(devkit_root, path, filename)
214215
meta = sio.loadmat(metafile, squeeze_me=True)['synsets']
215216
idcs, wnids, classes = list(zip(*meta))[:3]

0 commit comments

Comments
 (0)