Home

Explore the TensorFlow Installation

|
|  Updated:  
2018-06-18 21:35:05
|   From The Book:  
TensorFlow For Dummies
Explore Book
Buy On Amazon
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

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
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 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 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 odeint function, 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.

About This Article

This article is from the book: 

About the book author:

Matthew Scarpino has been a programmer and engineer for more than 20 years. He has worked extensively with machine learning applications, especially those involving financial analysis, cognitive modeling, and image recognition. Matthew is a Google Certified Data Engineer and blogs about TensorFlow at tfblog.com.