Understanding TensorFlow 1.x
It is generally the tradition that the first program one learns to write in any computer language is "hello world." We maintain the convention in this book! Let's begin with a Hello World program:
import tensorflow as tf
message = tf.constant('Welcome to the exciting world of Deep Neural Networks!')
with tf.Session() as sess:
print(sess.run(message).decode())
Let us go in depth into this simple code. The first line imports tensorflow
. The second line defines the message using tf.constant
. The third line defines the Session()
using with
, and the fourth runs the session using run()
. Note that this tells us that the result is a "byte string." In order to remove string quotes and b (for byte) we use the method decode()
.
TensorFlow 1.x computational graph program structure
TensorFlow 1.x is unlike other programming languages. We first need to build a blueprint of whatever neural network we want...