深度学习笔记1
深度学习中整个模型建立的大概思路 1、导入所需要的包(tensorflow,numpy) import tensorflow as tf import numpy as np from tensorflow . examples . tutorials . mnist import input_data 1.5编写所需的函数 #权重初始化 def weight_variable ( shape ) : initial = tf . truncated_normal ( shape , stddev = 0.1 ) return tf . Variable ( initial ) def bias_variable ( shape ) : initial = tf . constant ( 0.1 , shape = shape ) return tf . Variable ( initial ) #卷积和池化 def conv2d ( x , w ) : return tf . nn . conv2d ( x , w , strides = [ 1 , 1 , 1 , 1 ] , padding = "SAME" ) def max_pool_2x2 ( x ) : return tf . nn . max_pool ( x , ksize = [ 1 , 2 , 2 , 1 ]