โ† All tutorials
TensorFlow

TensorFlow โ€” build, train & ship models anywhere

TensorFlow is Google's open-source, end-to-end machine-learning platform. You define a neural network, train it on data, and โ€” crucially โ€” deploy it anywhere: servers, phones, browsers, microcontrollers. Its high-level Keras API makes building models approachable; its production tooling is its real superpower.

dataโ†’ build (Keras)โ†’ trainโ†’ deploy anywhere
One line. TensorFlow turns "I have data and want a model in production โ€” on a server, a phone, or in a browser" into one toolchain, with training and deployment covered end to end.

Why  The problem it solves

Training a neural network from scratch means writing tensor math, gradients (backpropagation), GPU/TPU kernels, data pipelines, and โ€” the part most tools ignore โ€” a reliable path to production. TensorFlow provides all of it as one platform, so teams don't stitch together bespoke code for every step.

๐Ÿงฎ The math & gradients

Tensors, GPU/TPU acceleration and automatic differentiation โ€” you describe the model, it computes the gradients.

๐Ÿ—๏ธ Building models

Keras layers/models make defining, training and evaluating networks a few readable lines.

๐Ÿš€ Getting to production

Serving, mobile/edge, browser and pipelines โ€” TensorFlow's standout strength is deployment.

Mechanics  How it works

Everything is a tensor (an n-dimensional array). Operations on tensors form a computational graph; TensorFlow can run it eagerly (like normal Python) or compile it with tf.function into an optimized graph for speed and portability. Training uses automatic differentiation (a GradientTape records operations, then computes gradients) driven by an optimizer.

tensorsโ†’ layers (Keras)โ†’ forward passโ†’ lossโ†’ gradientsโ†’ optimizer updates

Most of the time you don't write the loop yourself โ€” Keras's model.fit() handles it. Drop to a GradientTape loop only when you need custom control.

TensorFlow / Keras
# High-level Keras: define โ†’ compile โ†’ fit. The training loop is handled.
import tensorflow as tf
from tensorflow import keras

model = keras.Sequential([
    keras.layers.Dense(64, activation="relu"),
    keras.layers.Dense(10, activation="softmax"),
])
model.compile(optimizer="adam",
              loss="sparse_categorical_crossentropy",
              metrics=["accuracy"])

model.fit(x_train, y_train, epochs=5)        # training loop for free
model.evaluate(x_test, y_test)

Reach  The deployment ecosystem

This breadth is why TensorFlow persists in production even as research moved elsewhere:

๐Ÿ–ฅ๏ธ TF Serving

High-performance model serving for server/back-end inference at scale.

๐Ÿ“ฑ LiteRT (TF Lite)

Run models on phones, embedded devices and microcontrollers.

๐ŸŒ TensorFlow.js

Train and run models directly in the browser or Node.js.

๐Ÿ”ง TFX

End-to-end MLOps pipelines: validation, training, deployment.

โšก TPU support

First-class acceleration on Google's Tensor Processing Units.

๐Ÿ“Š TensorBoard

Visualize metrics, graphs and training runs.

The trade-offs  Limitations

What to weigh

Ergonomics The API has historically been more verbose and less "pythonic" than PyTorch, with several overlapping ways to do the same thing. Graph/eager mode and tf.function quirks can make debugging harder.

Churn The TF1 โ†’ TF2 transition was disruptive and broke a lot of code and trust; API sprawl remains a complaint.

Research mindshare The research community has largely shifted to PyTorch, so new papers, models and tutorials often land in PyTorch first.

Flexibility For fast, unconventional experimentation, TF's compiled-graph heritage feels less immediate than PyTorch's define-by-run style.

Net: TensorFlow trades some research ergonomics for an unmatched, battle-tested deployment story across server, mobile, edge and browser.

TensorFlow vs PyTorch, JAX & Keras

FrameworkBySweet spotNote
TensorFlowGoogleProduction & deploymentServing, mobile/edge, browser, TPU, MLOps
PyTorchMeta / PyTorch Fdn.Research & prototypingPythonic, dynamic, dominant ecosystem (details)
JAXGoogleHigh-performance researchFunctional, composable transforms (grad/jit/vmap)
Keras 3โ€”High-level APINow multi-backend: runs on TF, PyTorch or JAX
Keras is the bridge. Keras 3 runs on top of TensorFlow, PyTorch or JAX โ€” so the friendly high-level API isn't locked to one engine anymore.

When to choose TensorFlow

If youโ€ฆTensorFlow fit
Need to deploy to mobile / edge / microcontrollersโœ… Strong โ€” LiteRT
Need to run models in the browserโœ… Strong โ€” TensorFlow.js
Want robust, scalable serving & MLOps pipelinesโœ… Strong โ€” TF Serving + TFX
Train on Google TPUsโœ… First-class support
Do cutting-edge research / follow the latest papersโš ๏ธ PyTorch usually leads
Have an existing TensorFlow codebase/teamโœ… Stay put
Rule of thumb. Choose TensorFlow when deployment reach (mobile, edge, browser, TPU, production MLOps) is the priority; choose PyTorch when research speed and flexibility matter most.

Cheat sheet

QuestionShort answer
What is TensorFlow?Google's end-to-end ML platform for building, training & deploying models.
Its standout strength?Deployment: serving, mobile/edge (LiteRT), browser (TF.js), TPU, MLOps (TFX).
Easiest way to build a model?The Keras API โ€” Sequential, compile, fit.
How does training work?Autodiff via GradientTape + an optimizer (or just model.fit).
Biggest caveats?Verbose API, TF1โ†’TF2 churn, research shifted to PyTorch.
Main alternative?PyTorch (research); JAX for high-performance research.

Knowledge check

Six questions on TensorFlow. Pick an answer for each, then check your score.

1. What is TensorFlow's standout strength versus PyTorch?

2. What is the high-level API most people use to build TensorFlow models?

3. How does TensorFlow compute gradients for training?

4. You want to run a model on a microcontroller or phone. Which TensorFlow tool?

5. Which is a real limitation of TensorFlow?

6. What is Keras 3's notable change?

Next steps

๐Ÿ”ฅ PyTorch

The other giant โ€” the research-favorite framework, compared head to head.

๐Ÿชช Hands-on CV lab

Train a real model โ€” label, train weights, and read driver-licence fields, from scratch.

๐Ÿงฌ Embedding models

Models that make vectors โ€” often built and trained with TensorFlow or PyTorch.

๐Ÿค– LLM apps

Build on top of models โ€” the application layer above the frameworks.

๐Ÿ““ All tutorials

The hub โ€” LLMs, embeddings, retrieval, agents & more.