Repository: incubator-singa Updated Branches: refs/heads/master f5af1c372 -> 782735192
SINGA-332 Fix the bug of loading data in train.py of cifar10 Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/78273519 Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/78273519 Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/78273519 Branch: refs/heads/master Commit: 7827351926f63e655e30598062f6f398b13c0ff5 Parents: f5af1c3 Author: Wentong-DST <[email protected]> Authored: Wed Oct 25 14:25:16 2017 +0800 Committer: Wentong-DST <[email protected]> Committed: Wed Oct 25 14:25:16 2017 +0800 ---------------------------------------------------------------------- examples/cifar10/train.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/78273519/examples/cifar10/train.py ---------------------------------------------------------------------- diff --git a/examples/cifar10/train.py b/examples/cifar10/train.py index 9f1ffd2..07d91c7 100644 --- a/examples/cifar10/train.py +++ b/examples/cifar10/train.py @@ -47,7 +47,10 @@ import resnet def load_dataset(filepath): print('Loading data file %s' % filepath) with open(filepath, 'rb') as fd: - cifar10 = pickle.load(fd, encoding='latin1') + try: + cifar10 = pickle.load(fd, encoding='latin1') + except TypeError: + cifar10 = pickle.load(fd) image = cifar10['data'].astype(dtype=np.uint8) image = image.reshape((-1, 3, 32, 32)) label = np.asarray(cifar10['labels'], dtype=np.uint8)
