In TensorFlow, there are built-in functions that carry out the convolution steps for you.
-
tf.nn.conv2d(X,W1, strides = [1,s,s,1], padding = 'SAME'): given an input
$X$ and a group of filters$W1$ , this function convolves$W1$ 's filters on X. The third input ([1,f,f,1]) represents the strides for each dimension of the input (m, n_H_prev, n_W_prev, n_C_prev). You can read the full documentation here -
tf.nn.max_pool(A, ksize = [1,f,f,1], strides = [1,s,s,1], padding = 'SAME'): given an input A, this function uses a window of size (f, f) and strides of size (s, s) to carry out max pooling over each window. You can read the full documentation here
-
tf.nn.relu(Z1): computes the elementwise ReLU of Z1 (which can be any shape). You can read the full documentation here.