Now, it's time to build the core of the model. The computational graph includes all the layers we mentioned earlier in this chapter. We'll start by defining some functions that will be used to define variables of a specific shape and randomly initialize them:
def new_weights(shape): return tf.Variable(tf.truncated_normal(shape, stddev=0.05))
def new_biases(length): return tf.Variable(tf.constant(0.05, shape=[length]))
Now, let's define the function that will be responsible for creating a new convolution layer based on some input layer, input channels, filter size, number of filters, and whether to use pooling parameters or not:
def conv_layer(input, # the output of the previous layer. input_channels, filter_size, ...