from scipy.io import loadmatimport numpy, cPickle data_dict=loadmat(r'E:/dataset/CIFAR10/CIFAR10_small.mat') #need an r! my_array=numpy.array([1,1])for key in data_dict.keys(): if type(data_dict[key]) == type(my_array): #print matrix information print key, type(data_dict[key]), print data_dict[key].shape #shape(n,1) (matrix in theano) -> shape(n,) (vector in theano)print data_dict['Ytr'].shapeYtr=numpy.hstack(data_dict['Ytr'])Yte=numpy.hstack(data_dict['Yte'])Yte=numpy.hstack(data_dict['Yte'])print Ytr.shape train_set=(data_dict['Xtr'],Ytr)valid_set =(data_dict['Xte'],Yte)test_set =(data_dict['Xte'],Yte) output = open('cifar10_small_v.pkl', 'wb') cPickle.dump(train_set, output)cPickle.dump(valid_set, output)cPickle.dump(test_set, output) output.close()print 'save is done' pkl_file = open('cifar10_small_v.pkl', 'rb') data1 = cPickle.load(pkl_file) # is train_setdata2 = cPickle.load(pkl_file) # is valid_setdata3 = cPickle.load(pkl_file) # is test_set print type(data1[1]),data1[1].shape pkl_file.close()