July 2019
Intermediate to advanced
512 pages
19h 39m
English
Now, we will perform the BPTT, with Adam as our optimizer. We will also perform gradient clipping to avoid the exploding gradients problem:
minimizer = tf.train.AdamOptimizer()
gradients = minimizer.compute_gradients(loss)
threshold = tf.constant(5.0, name="grad_clipping")
clipped_gradients = []for grad, var in gradients: clipped_grad = tf.clip_by_value(grad, -threshold, threshold) clipped_gradients.append((clipped_grad, var))
updated_gradients = minimizer.apply_gradients(clipped_gradients) ...
Read now
Unlock full access