Explore the TensorFlow Installation
After you install TensorFlow, you have a directory named
tensorflow that contains a wide variety of files and folders. Two top-level folders are particularly important. The core directory contains the TensorFlow’s primary packages and modules. The
contrib directory contains secondary packages that may later be merged into core TensorFlow.
When you write a TensorFlow application, it’s important to be familiar with the different packages and the modules they provide. The table lists the all-important
tensorflow package and nine other packages.
Important TensorFlow Packages
||Central package of the TensorFlow framework, commonly accessed as tf|
||Optimizers and other classes related to training|
||Neural network classes and related math operations|
||Functions related to multilayer neural networks|
||Volatile or experimental code|
||High-level tools for training and evaluation|
||Functions that write data to a log|
||Classes needed to generate summary data|
||Functions for measuring the outcome of machine learning|
The first package,
tensorflow, is TensorFlow’s central package. Most applications import this package as
tf, so when you see
tf in code or an example, remember that it refers to the
Training is a crucial operation in machine learning applications. The
tf.train package provides many of the modules and classes needed for TensorFlow training. In particular, it provides the optimizer classes that determine which algorithm should be used for training.
tf.layers packages provide functions that create and configure neural networks. The two packages overlap in many respects, but the functions in
tf.layers focus on multilayer networks, while the functions in
tf.nn are suited toward general purpose machine learning.
Many of the packages in
tf.contrib contain variants of core capabilities. For example,
tf.contrib.nn contains variants of the features in
tf.contrib.layers contains variants of the features in
tf.contrib also provides a wealth of interesting and experimental packages, including the following:
tf.contrib.keras: Makes it possible to interface TensorFlow using the Keras interface
tf.contrib.ffmpeg: Enables audio processing through the open-source FFMPEG toolset
tf.contrib.bayesflow: Contains modules related to Bayesian learning
tf.contrib.integrate: Provides the
odeintfunction, which integrates ordinary differential equations
The last three packages in the table enable developers to analyze their applications and produce output. The functions in
tf.logging enable logging and can be used to write messages to the log. The classes and functions in
tf.summary generate data that can be read by TensorBoard, a utility for visualizing machine learning applications. The functions in
tf.metrics analyze the accuracy of machine learning operations.