Checking whether your installation works

Now that you have installed TensorFlow, let's check whether it works correctly. In your Command Prompt, activate your environment again if it isn't already, and run Python by entering the following:

    (tf_env)$ python

Now, enter the following lines into the Python interpreter to test that TensorFlow is installed correctly:

 >>>> import tensorflow as tf
>>>> x = tf.constant('Tensorflow works!')
>>>> sess = tf.Session()
>>>> sess.run(x)

If everything is installed correctly, you should see the following output:

 

b'Tensorflow works!'

What you just typed there is the Hello World of TensorFlow. You created a graph containing a single tf.constant, which is just a constant Tensor. The Tensor was inferred to be of type string as you passed a string to it. You then created a TensorFlow Session, which is needed to run your graph and told your session to run on the Tensor that you created. The result of the Session running was then printed out. There is an extra b there because it's a byte stream that was created.

If you don't see the aforementioned and are getting some errors, your best bet is to check the following pages for solutions to common problems experienced when installing:
Ubuntu: https://www.tensorflow.org/install/install_linux#common_installation_problems
Windows: https://www.tensorflow.org/install/install_windows#common_installation_problems
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.162.49