September 2017
Intermediate to advanced
622 pages
15h 13m
English
Now let's learn about an interesting TensorFlow mechanic. TensorFlow provides a mechanism for making decisions when building a graph. However, there are some subtle differences when we use Python's control flow statements compared to TensorFlow's control flow functions, when constructing computation graphs.
To illustrate these differences with some simple code examples, let's consider implementing the following equation in TensorFlow:

In the following code, we may naively use Python's if statement to build a graph that corresponds to the preceding equation:
>>> import tensorflow as tf >>> >>> x, y ...