Let's look at an example of Hello, world! using TensorFlow. We will go over this example directly in the Python shell:
- Enter the Python shell.
- Import TensorFlow with the following command:
>>>import tensorflow as tf
- TensorFlow can understand constants, variables, and operations, when defined with a tf base definition. Define a constant string as follows:
>>>hello_world = tf.constant("Hello, world!")
- Create a session:
>>>sess = tf.Session()
- Run the session:
- The output should be as follows:
Congratulations! You have written your first program using TensorFlow. Next, we will introduce a few concepts for using TensorFlow.