环境:tensorflow1.1,python3
"""
python3
tensorflow 1.1
matplotlib 2.02
cifar文件包含训练集50000张,测试集合10000张
数据集为matlab类型
data_batch_1训练集样本数据10000张
data_batch_2训练集样本数据10000张
data_batch_3训练集样本数据10000张
data_batch_4训练集样本数据10000张
data_batch_5训练集样本数据10000张
"""
import tensorflow as tf
import scipy.io as sio
import numpy as np
import matplotlib.pyplot as plt
learning_rate = 0.0001
batch_size = 128
def read_data(filename):
with open(filename,'rb') as f:
dict = sio.loadmat(f)
return np.array(dict['data']).reshape(10000,3,32,32).transpose(0,2,3,1),np.array(dict['labels']).reshape(10000,1)
def