- tf.nn.conv2d()函数来计算卷积,weights作为滤波器,[1,2,2,1]作为strides
- input_image维度使用一个单独的stride参数,[batch,input_height,input_width,input_channels]
- input_height和input_width strides表示滤波器在input上移动的步长。在input之后,设置了一个5*5,stride为2的滤波器
- tf.nn.bias_add()函数对矩阵的最后一维加了偏置项
k_output = 64
image_width = 10
image_height = 10
color_channels = 3
filter_size_width = 5
filter_size_height = 5
input_image = tf.placeholder(tf.float32,shape = [None,image_height,image_width,color_channels])
weight = tf.Variable(tf.truncated_normal([filter_size_height,filter_size_width,color_channels,k_output]))
bias = tf.Variable(tf.zeros(k_output))
conv_layer = tf.nn.conv2d(input_image,weight,strides=[1,2,2,1],padding="SAME")
conv_layer = tf.nn.bias_add(conv_layer,bias)
conv_layer = tf.nn.relu(conv_layer)