TensorFlow uses tensors as inputs as well as outputs. A component that transforms input into output is called an operation. A computer vision model is therefore composed of multiple operations.
TensorFlow represents these operations using a directed acyclic graph (DAC), also referred to as a graph. In TensorFlow 2, graph operations have disappeared under the hood to make the framework easier to use. Nevertheless, the graph concept remains important to understand how TensorFlow really works.
When building the previous example using Keras, TensorFlow actually built a graph:
While very simple, this graph represents the different layers of our model in the form of operations. Relying on graphs has many advantages, allowing TensorFlow to do the following:
- Run part of the operations on the CPU and another...