What is TensorFlow?

In short
TensorFlow is an open-source platform from Google for building and training machine learning models. It gives developers a set of APIs, tools and runtimes so that a model can be built once and run in many environments, from a laptop to a server or a mobile device. Most people use its Keras interface to define models in a few lines of Python.
What TensorFlow does
TensorFlow is a platform for machine learning, the practice of teaching a program to find patterns in data instead of following hand-written rules. The name comes from the way it handles data: as tensors, which are multi-dimensional arrays of numbers. A single number is a tensor with zero dimensions, a list of numbers is one dimension, a table is two, and a batch of images is usually four.
The official project describes TensorFlow as an end-to-end platform. In practice, that means one toolkit covers most of the path from raw data to a working model: loading data, defining the model, training it, measuring how well it works and exporting it so that other software can run it. You can read more about the building blocks behind models in our guide to neural networks.
How it works
A TensorFlow program usually does four things. It loads a dataset, it describes the model as a stack of layers, it chooses how the model should learn, and it runs a training loop. The official example shows this flow with the handwritten digit dataset MNIST, which contains images of the digits 0 to 9.
The model is a sequence of layers. The first layer, Flatten, turns each 28 by 28 pixel image into a row of 784 values. Two Dense layers then transform those values, and a Dropout layer randomly switches off some connections during training to reduce memorization. The last layer has ten outputs, one for each digit, and uses the softmax function to turn them into probabilities.
The compile step sets the rules for learning. The example uses the Adam optimizer, which adjusts the model's weights during training, and a loss function called sparse categorical crossentropy, which measures how far the predictions are from the correct labels. The fit step then runs training for five passes over the data, which the documentation calls epochs. Finally, evaluate checks the model on test images it has never seen.
The code is short because Keras, the high-level API bundled with TensorFlow, hides many of the low-level details. You can still reach down to lower levels when you need more control.
Where it runs
The documentation stresses that TensorFlow lets you create models that run in many environments. The same model can be trained on a workstation and then deployed elsewhere. Teams use separate tools in the wider ecosystem for serving models to users, for running them on phones and small devices, and for running them in web browsers.
This portability matters for production work. A model that only works on the machine where it was trained is hard to use in a product. Packaging and deployment are part of the wider discipline of MLOps, which covers how models move from experiments into reliable services.
Common mistakes
Beginners often skip the normalization step. The example divides pixel values by 255 so that they fall between 0 and 1. Without this, training is usually slower and less stable.
Another frequent problem is judging a model only by its training accuracy. The evaluate call on separate test data is there for a reason. If training accuracy is high and test accuracy is much lower, the model may be overfitting, which means it has learned the training examples rather than the general pattern.
Beginners also sometimes mix up the output format with the loss function. The loss name must match the labels. Here the labels are plain integers from 0 to 9, which is why the sparse version of crossentropy is used.
Learning TensorFlow
If you are new to machine learning, start with the official curriculums and the resource library on the TensorFlow site. Run the example in a notebook, change the number of epochs or the size of the dense layer, and watch how the accuracy changes. Once the basics feel clear, try your own dataset. Experimenting with small changes is the fastest way to build intuition.
It also helps to know the vocabulary used across the field. Our guides on deep learning and convolutional neural networks explain the ideas behind many of the layers you will see in TensorFlow code.
FAQ
Is TensorFlow free to use?
TensorFlow is an open-source project, so you can download and use it without paying for the library itself. Check the official site for current license terms and for any cloud services you might add on top.
Do I need to know Python to use TensorFlow?
The official examples are written in Python, and most tutorials use it, so Python is the usual choice. Basic Python skills are enough to follow the Keras examples on the official site.
What is the difference between TensorFlow and Keras?
Keras is a high-level API that is included in TensorFlow. It lets you describe models with short, readable code, while TensorFlow provides the underlying engine and tools.
Do I need a GPU to run TensorFlow?
No. TensorFlow can run on a CPU, which is enough for small examples like the MNIST model. Larger models often train faster on a GPU, but that is not required to learn the basics.
Sources
This page is based on the official documentation below. Read it for full detail.
TensorFlow — official documentation ↗TensorFlow in the news
Anthropic Ports Claude API From Python to Rust Using Production Traffic as the Test
Anthropic says it rewrote its Messages API from Python to Rust without downtime, cutting CPU use by about 70%. The main challenge was verifying the new code, which it did by comparing live traffic against the old service.
