tensorflow

Tensor flow : All about Google’s Machine Learning framework

Margalith

Margalith

4 min

TensorFlow is a Machine Learning framework created by Google and available in open source. Discover everything you need to know about it: history, functioning, advantages, training...

Machine Learning is a complex discipline, but fortunately there are tools that simplify its implementation. Among these resources, there is the TensorFlow framework from Google.

It is an open-source library for numerical computation and Machine Learning compatible with the Python language. It simplifies the process of acquiring data, training Machine Learning models, generating predictions and refining future results.

TensorFlow combines Machine Learning and Deep Learning models and algorithms. The Python language provides a convenient and comfortable front-end API for creating applications using this framework. These applications can then be executed in C++.

The framework can be used to train and run deep neural networks for handwritten digit classification, image recognition, lexical embedding, recurrent neural networks, sequence-to-sequence models for machine translation, natural language processing, and simulations based on partial differential equations.

The history of TensorFlow

TensorFlow was initially created by the Google Brain team. The goal was originally to use neural networks to improve Google services such as Gmail, Photos or the search engine.

Thanks to this framework, researchers and developers could work together on an AI model. Subsequently, TensorFlow was made public at the end of 2015 for the first time. However, the first stable release dates back to 2017.

This tool is open source under the Apache Open Source license. Therefore, it is possible to use it, modify it and redistribute the modified version in commercial form without paying Google.

How does it work ?

Developers can create “dataflow graphs”. These are structures to describe how data is transferred through graphs or a series of processing nodes.

Each node in the graph represents a mathematical operation. Each connection between the nodes is a multidimensional data array: a tensor.

Interaction with TensorFlow is done through the Python language, which is both simple to learn and to use. This language makes it easy to express how high-level abstractions can be coupled together.

TensorFlow nodes and tensors are Python objects. TensorFlow applications, themselves, are Python applications. 

However, the mathematical operations themselves are not performed in Python. The transformation libraries accessible via TensorFlow are written as high-performance C++ binaries. The Python language simply directs traffic between the various parts and allows them to be connected through high-level abstractions.

TensorFlow applications can run on a local machine, a cluster in the cloud, iOS or Android smartphones and tablets, or CPUs and GPUs. On its own Cloud, Google offers to run TensorFlow on its TensorFlow Processing Unit (TPU) chips to take advantage of increased acceleration. The models created by TensorFlow can then be deployed on any device to deliver predictions.

With TensorFlow 2.0, launching in October 2019, the framework has undergone a major overhaul. The changes made are based on user feedback.

This new version is more powerful and easier to use, especially via the use of the Keras API for model training. A new API simplifies distributed training.

Compatibility with TensorFlow Lite allows models to be deployed on a wider variety of platforms. The only downside is that code written for earlier versions of TensorFlow must be rewritten to take full advantage of the new features in TensorFlow 2.0.

The advantages of TensorFlow

TensorFlow brings many advantages for Machine Learning development. One of the main ones is abstraction.

Rather than having to dwell on the details of implementing algorithms or connecting functions, developers can focus on the overall logic of the application. The framework takes care of the technical details.

Debugging and inspection of applications is also simplified. For example, the “eager execution” mode allows each operation of a graph to be evaluated and modified separately. The graph is therefore not a single, opaque object that has to be evaluated completely. The TensorBoard visualization suite, on the other hand, allows inspection of how graphs are executed through an interactive web-based dashboard.

In addition, the fact that Google is behind this project is a real asset. This has not only accelerated development, but also created many offers around TensorFlow simplifying its deployment and use.

We can mention the TPU chips allowing increased performance on the Google Cloud, but also an online hub for sharing models created with the framework, or the mobile and web versions.

Alternatives to TensorFlow

There are several alternatives to TensorFlow on the Machine Learning framework market. Among the most popular are PyTorch, CNTK and MXNet.

PyTorch has many similarities with TensorFlow. This framework is based on the Python language, and relies on hardware accelerated components. It also offers a highly interactive development model and many useful components already included.

Overall, Pytorch is a better choice for rapid project development. On the other hand, TensorFlow is preferred for larger projects and more complex workflows.

CNTK is the Microsoft Cognitive suite of tools. Like TensorFlow, it uses a graphical structure to describe data flows. However, it focuses on the creation of Deep Learning neural networks.

As a result, CNTK can handle neural network tasks faster. It also offers a wider set of APIs: Python, C++, C#, Java… it is however more difficult to master and deploy than TensorFlow.

Finally, Apache MXNet has been adopted by Amazon as the main Deep Learning framework on AWS. It can be linearly extended across multiple GPUs and machines. This framework is compatible with a wide variety of programming language APIs: Python, C++, Scala, R, JavaScript, Julia, Perl, Go…

How do I learn to use it?

To learn how to use TensorFlow, you can turn to our Machine Learning Engineer training. You’ll learn how to use all the major Machine Learning Engineer tools and techniques, including Google’s framework.

You know all about TensorFlow. Learn about other must-have Machine Learning tools, like the Apache AirFlow workflow scheduler and the GitHub code hosting service.