What is Tensor Flow?

TensorFlow is a programming framework for building machine learning and deep learning software. It works by holding data in multi-dimensional structures known as tensors. The TensorFlow libraries support Python and JavaScript.

Developed by Google, TensorFlow is now an open-source solution for tackling ML and AI problems related to Big Data. It's a versatile system, notably for its ability to run on GPUs and mobile devices, as well as CPUs.

What is the Structure of TensorFlow?

The TensorFlow libraries consist of multiple APIs that can be roughly divided into two categories: low-level and high-level.

Low-level TensorFlow APIs

The TensorFlow Core API is the main engine of TensorFlow. Developers can integrate TensorFlow Core into their own Python or JavaScript code, allowing them to create powerful machine learning applications.

TensorFlow Core is powerful but has a steep learning curve. Anyone working with Core must understand not only the main API but also the data concepts that form the basis of TensorFlow. 

High-level TensorFlow APIs

These are a collection of high-level tools and libraries that run on TensorFlow. Some of them help to create models that can form the basis of a graph. Others provide a modular layer that makes it possible to develop without knowing all the ins and outs of TensorFlow. 

Many of these APIs are smaller and more consistent than the Core API, and come with a much more forgiving learning curve. 

TensorFlow Core Key Concepts

Working with TensorFlow Core means engaging with some complex data science. The main concepts to know include:

Tensors

A tensor is a multi-dimensional collection of data. Each tensor has four key attributes: rank, shape type, and label. A tensor's rank is the number of dimensions, so a single column of data has rank 1, while a table has rank 2. Tensors can have unlimited dimensions.

Shape refers to the tensor's overall size, which is the combined size of each dimension. Tensors have a single data type, which the developer specifies on instantiation. Finally, each tensor has a name, or label. Tensors are objects defined by the tf.Tensor class.

Graphs

Graphs are the basis of computation in TensorFlow. A graph consists of nodes and connectors called edges. Each node represents an operational function, defined in a tf.Operation object. The edges contain tensors. During execution, tensors pass through nodes. The nodes process the data accordingly and pass the results along to the next node on the graph.

Sessions

To process data in TensorFlow, developers must first create a session and call its run method (tf.Session.run). The arguments of this method specify the starting point of the graph. The session then prompts the execution of all relevant operations in the correct sequence, eventually producing the desired output.  

Constants

Constants are edges that do not contain tensors. These can be simple data types, such as integers, or a more complex construct such as a NumPy array. The tf.constant function creates constant values.

Variables

Variables are similar to constants, except that their values can change during runtime. The tf.Variable function declares variables.

Placeholders

A placeholder is an empty tensor. The code defines a placeholder's structure, but put passes values dynamically during runtime. This allows developers to provide a new tensor in each session.

TensorBoard

TensorBoard is a command-line tool that allows developers to visualize their TensorFlow graphs. This tool works with the logs that a TensorFlow session generates, and users can choose to view the data in multiple formats.

What are the High-Level TensorFlow APIs?

TensorFlow comes packaged with several high-level APIs that developers can use to create machine learning systems or neural networks. These APIs rely on TensorFlow Core to perform data operations. However, these APIs generally offer a gentler learning curve for people who are building applications. They also provide a higher degree of modularity, as they don't require coders to work directly with the TensorFlow Core API.

Keras

TensorFlow and Keras have become inextricably linked in recent years, although the two libraries are independent of each other. Keras is a high-level API that uses TensorFlow as a deep learning backend.

The main feature of Keras is usability. The Keras API is relatively straightforward, and many developers or data scientists can pick it up with ease. It's also highly configurable and modular, which means that it's possible to build extremely sophisticated applications on this framework.

TF Estimator 

When working with the TensorFlow Core API, developers have to build graphs from scratch. TF Estimator can perform much of this hard work by estimating the data model required for the available data. 

Estimator has some high-level functions such as estimator.evaluate, estimator.predict(), and estimator.export. The output of this API is an object that contains the suggested data model. This can then be fine-tuned to fit the data. 

TF Slim

TF Slim is a lightweight library that can define and train machine learning models. Developers build the model using slim layers, then create a session with the appropriate data sources. 

The resulting operation estimates any error or data loss, and developers can then optimize to improve accuracy. 

TFLearn

TFLearn is a highly transparent API that allows for the rapid creation and modeling of prototypes. Users have full control over individual tensors, and there are some detailed visualization tools available. This makes it possible to monitor and control the way models develop. 

TFLearn also comes with examples and tutorials, which makes it an ideal educational tool for developers who want to learn more about the functionality of TensorFlow Core.  

Pretty Tensor

This API is a TensorFlow wrapper that's used in the development of neural networks. With Pretty Tensor, developers can create objects that resemble tensors. These objects have a chainable syntax that is ideal for building complex structures, such as neural networks. 

Sonnet

Sonnet is an object-oriented Python library that creates an abstraction layer for TensorFlow. Sonnet modules are extremely flexible, self-contained, and decoupled from all other modules. 

Share This Article
facebook linkedin twitter

Glossary of Terms

A guide to the nomenclature of data integration technology.