Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Recurrent Neural Networks with Python Quick Start Guide

You're reading from  Recurrent Neural Networks with Python Quick Start Guide

Product type Book
Published in Nov 2018
Publisher Packt
ISBN-13 9781789132335
Pages 122 pages
Edition 1st Edition
Languages
Author (1):
Simeon Kostadinov Simeon Kostadinov
Profile icon Simeon Kostadinov

Training the chatbot

Once we have defined the model graph, we want to train it using our input data. Then, we will have a well-tuned set of parameters that can be used for accurate predictions. 

First, we specify the TensorFlow's Session object that encapsulates the environment in which Operation (summation, subtraction, and so on) objects are executed and Tensor (placeholders, variables, and so on) objects are evaluated:

sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True, log_device_placement=False))
sess.run(tf.global_variables_initializer())

A good explanation of the config parameter can be found at https://stackoverflow.com/questions/44873273/what-do-the-options-in-configproto-like-allow-soft-placement-and-log-device-plac. In summary, once we specify allow_soft_placement, the operations will be executed on the CPU only if there is no GPU registered...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}