How it works...
The function begins with creating a shape tensor; namely, the list of four integers that are the width of a filter, the height of a filter, the number of input channels, and the number of given filters. Using this shape tensor, initialize a tensor of new weights with the defined shape and create a tensor a new (constant) biases, one for each filter.
Once the necessary weights and biases are initialized, create a TensorFlow operation for convolution using the tf$nn$conv2d function. In our current setup, the strides are set to 1 in all four dimensions and padding is set to SAME. The first and last are set to 1 by default, but the middle two can factor in higher strides. A stride is the number of pixels by which we allow the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access