TensorFlow programming model
The TensorFlow programming model signifies how to structure your predictive models. A TensorFlow program is generally divided into four phases once you have imported TensorFlow library for associated resources:
- Construction of the computational graph that involves some operations on tensors (we will see what is a tensor soon)
- Create a session
- Running a session, that is performed for the operations defined in the graph
- Computation for data collection and analysis
These main steps define the programming model in TensorFlow. Consider the following example, in which we want to multiply two numbers:
import tensorflow as tf x = tf.constant(8) y = tf.constant(9) z = tf.multiply(x, y) sess = tf.Session() out_z = sess.run(z) Finally, ...