Unverified Commit 32b96851 authored by newcoder's avatar newcoder Committed by GitHub
Browse files

Update generate_cifar10_tfrecords.py

change cPickle to pickle for python3
specify  encoding='latin1' when call pickle.load()
parent b7edd6e3
...@@ -24,7 +24,7 @@ from __future__ import division ...@@ -24,7 +24,7 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
import argparse import argparse
import cPickle import pickle
import os import os
import tarfile import tarfile
...@@ -49,7 +49,7 @@ def _int64_feature(value): ...@@ -49,7 +49,7 @@ def _int64_feature(value):
def _bytes_feature(value): def _bytes_feature(value):
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[str(value)])) return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
def _get_file_names(): def _get_file_names():
...@@ -62,8 +62,8 @@ def _get_file_names(): ...@@ -62,8 +62,8 @@ def _get_file_names():
def read_pickle_from_file(filename): def read_pickle_from_file(filename):
with tf.gfile.Open(filename, 'r') as f: with tf.gfile.Open(filename, 'rb') as f:
data_dict = cPickle.load(f) data_dict = pickle.load(f, encoding='latin1')
return data_dict return data_dict
......
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