Convolutional layer application
Now let's implement a simple convolutional layer in TensorFlow. First, we're going to go over the explicit shapes used in this example, as that's often tricky. Then we'll walk through the implementation and TensorFlow call for convolutions. Finally, we'll visually inspect the results of our convolution by passing in a simple example image.
Exploring the convolution layer
Let's jump right into the code with a fresh IPython session.
This is just a small example to help us get familiar with using TensorFlow for convolution layers.
After importing the necessary tools, let's make a fake 10x10 image but with larger values on the diagonal:
# Make some fake data, 1 data points image = np.random.randint(10,size=[1,10,10]) + np.eye(10)*10
Note the unusual size specified in the preceding code. The 10, 10
is just the image dimensions but the 1
refers to the number of input channels. In this case, we're using one input channel, which...