# What is TensorFlow, and why did Google give it away in 2015?

Date: 2021-07-30 · Author: Robert Scales · https://guidetoartificialintelligence.com/en/learn/what-is-tensorflow-and-why-did-google-open-source-it/

**Answer:** TensorFlow is a free software library for building and training machine learning models, especially neural networks, that Google released as open source on 9 November 2015. Google had used it internally as the successor to an older system called DistBelief, and by sharing it under a permissive license it handed researchers, students and companies the same tools its own engineers used.

Training a neural network involves a lot of arithmetic on large tables of numbers, repeated millions of times, ideally spread across many processors at once. In the early 2010s, every big lab wrote its own software to do this, and most of it never left the building. On 9 November 2015, Google changed that for its own tools. It published **TensorFlow**, the system its researchers were using every day, as free, open-source software that anyone could download, read, change and use.

For a beginner, TensorFlow is best thought of as a toolkit: you describe the model you want in a few lines of Python, and TensorFlow handles the math, the memory and the hardware.

## What Google released, and who announced it

The announcement came in a post on the Google Research blog by Jeff Dean, a Senior Google Fellow, and Rajat Monga, the project's technical lead. TensorFlow came from the **Google Brain** team, Google's deep learning research group.

Dean and Monga explained the background. Since 2011, Google had used an internal system called **DistBelief** to train ever larger neural networks across thousands of processor cores. It had powered some well-known results: the network that learned to recognize cats from unlabeled YouTube images, a 25 percent improvement in speech recognition in the Google app, and image search in Google Photos.

DistBelief had limits, though. It was built narrowly for neural networks, it was hard to configure, and it was so tied to Google's internal machinery that researchers could not share their code with anyone outside. TensorFlow was the second-generation replacement, designed to fix those problems. Google said that on some benchmarks it ran twice as fast as DistBelief.

Google released it with tools, tutorials and example models under the **Apache 2.0 license**, a permissive open-source license that allows free use, including in commercial products, at any institution.

## How it works: tensors flowing through a graph

The name describes the idea. A **tensor** is a block of numbers with any number of dimensions: a single number, a list, a table, or a stack of tables. A color photo, for example, is a three-dimensional tensor: height, width and three color channels.

In the original TensorFlow, you described a computation as a **graph**: a diagram of operations (multiply, add, compare) connected by arrows along which tensors flow. Once the graph was defined, TensorFlow could run it on a laptop's processor, a graphics card or many machines in a data center, without you rewriting the model.

Two features made it especially useful for machine learning:

- **Automatic differentiation.** Training a network means nudging each of its numbers in the direction that reduces error. Working out those directions by hand is tedious and error-prone; TensorFlow computes them automatically from the graph.
- **Portability.** The same model could move from training on a desktop graphics card to running on a mobile phone.

It also came with **TensorBoard**, a tool for watching a model's training progress in charts.

## A worked example

Here is a tiny model in today's TensorFlow (version 2) that learns the rule behind a few numbers. The pattern is y = 2x − 1, but we never tell it that:

```python
import tensorflow as tf

xs = [-1.0, 0.0, 1.0, 2.0, 3.0, 4.0]
ys = [-3.0, -1.0, 1.0, 3.0, 5.0, 7.0]

model = tf.keras.Sequential([tf.keras.layers.Dense(units=1, input_shape=[1])])
model.compile(optimizer="sgd", loss="mean_squared_error")
model.fit(xs, ys, epochs=500, verbose=0)

print(model.predict([10.0]))   # close to 19
```

What each step does:

| Line | What it means |
|---|---|
| `Dense(units=1)` | one artificial neuron with one weight and one bias |
| `compile(...)` | measure error as squared difference; improve with gradient descent |
| `fit(..., epochs=500)` | look at the examples 500 times, adjusting the weight and bias each time |
| `predict([10.0])` | apply what it learned to a new number |

TensorFlow calculates every adjustment for you. That same machinery scales up to networks with millions or billions of numbers.

> **Try it:** Paste the example into a free online notebook such as Google Colab, run it, then change the `ys` to follow y = 3x + 2. Check whether the prediction for 10 lands near 32.

## Why it mattered

Open-sourcing TensorFlow gave everyone a production-grade tool that had been tested at Google's scale. Adoption was fast. Speaking at Google I/O in June 2016, Dean reported that about 1,500 projects on GitHub mentioned TensorFlow, and only five of them came from Google.

Google kept building around it. In May 2016 it announced the **Tensor Processing Unit (TPU)**, a chip designed for machine learning and tailored to TensorFlow. Version 1.0 arrived in February 2017; TensorFlow Lite for phones and small devices was announced in May 2017, and TensorFlow.js for web browsers in March 2018. TensorFlow 2.0, released in September 2019, made the library easier to use by running operations immediately ("eager execution") instead of requiring a graph to be built first.

TensorFlow is not alone. PyTorch, another open-source library, has been gaining ground in research papers, which is one reason TensorFlow 2.0 adopted the run-immediately style. Still, TensorFlow helped set the expectation that major AI tools are shared openly. OpenAI's public code for GPT-2, for example, runs on TensorFlow.

## How can a beginner start experimenting with TensorFlow?

The easiest path needs no installation. Google Colab runs Python notebooks in your browser, so you can try the example above without setting anything up on your own computer. The official site, tensorflow.org, has tutorials that walk through small projects step by step.

A good learning sequence is: run a tutorial as written, change one thing (the data, the number of layers, the number of training rounds), and watch what happens. If you prefer a gentler start, TensorFlow includes **Keras**, a high-level interface where a model is a short list of layers, as in our example.

If coding is not your goal, it still helps to know the name. Many of the AI features you use every day, from photo search to voice typing, were built and trained with tools like TensorFlow, and its release is part of why so much AI research since 2015 has been shared and repeated by people outside the big companies.

## Sources

- TensorFlow - Google's latest machine learning system, open sourced for everyone: https://research.google/blog/tensorflow-googles-latest-machine-learning-system-open-sourced-for-everyone/
- TensorFlow: https://en.wikipedia.org/wiki/TensorFlow
