July 2019
Intermediate to advanced
512 pages
19h 39m
English
Now we define the functions for initializing weights and bias, and for performing the convolution and pooling operations.
Initialize the weights by drawing from a truncated normal distribution. Remember, the weights are actually the filter matrix that we use while performing the convolution operation:
def initialize_weights(shape): return tf.Variable(tf.truncated_normal(shape, stddev=0.1))
Initialize the bias with a constant value of, say, 0.1:
def initialize_bias(shape): return tf.Variable(tf.constant(0.1, shape=shape))
We define a function called convolution using tf.nn.conv2d(), which actually performs the convolution operation; that is, the element-wise multiplication of the input matrix (x) by the filter (
Read now
Unlock full access