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
Package | Content |
tensorflow |
Central package of the TensorFlow framework, commonly accessed as tf |
tf.train |
Optimizers and other classes related to training |
tf.nn |
Neural network classes and related math operations |
tf.layers |
Functions related to multilayer neural networks |
tf.contrib |
Volatile or experimental code |
tf.image |
Image-processing functions |
tf.estimator |
High-level tools for training and evaluation |
tf.logging |
Functions that write data to a log |
tf.summary |
Classes needed to generate summary data |
tf.metrics |
Functions for measuring the outcome of machine learning |
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 tensorflow
package.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.
The tf.nn
and 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.nn
and tf.contrib.layers
contains variants of the features in tf.layers
. 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 interfacetf.contrib.ffmpeg
: Enables audio processing through the open-source FFMPEG toolsettf.contrib.bayesflow
: Contains modules related to Bayesian learningtf.contrib.integrate
: Provides theodeint
function, which integrates ordinary differential equations
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.