
上QQ阅读APP看书,第一时间看更新
Updating the network
Now the deltas have been computed, it’s time to update the network’s parameters. In most cases, we use a type of gradient descent. Let represent the learning rate, the parameter update formula is:
This is written in TensorFlow code as follows:
eta = tf.constant(0.01)
step = [
tf.assign(w_1,
tf.subtract(w_1, tf.multiply(eta, d_w_1))),
tf.assign(b_1,
tf.subtract(b_1, tf.multiply(eta,
tf.reduce_mean(d_b_1, axis=[0])))),
tf.assign(w_2,
tf.subtract(w_2, tf.multiply(eta, d_w_2))),
tf.assign(b_2,
tf.subtract(b_2, tf.multiply(eta,
tf.reduce_mean(d_b_2, axis=[0]))))
]