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.
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)
# Custom loop with GradientTape โ full control over each training step.
opt = keras.optimizers.Adam()
loss_fn = keras.losses.SparseCategoricalCrossentropy()
for x, y in dataset: # tf.data pipeline
with tf.GradientTape() as tape: # record ops for autodiff
preds = model(x, training=True)
loss = loss_fn(y, preds)
grads = tape.gradient(loss, model.trainable_variables)
opt.apply_gradients(zip(grads, model.trainable_variables))
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.
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.
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
Question
Short answer
What is TensorFlow?
Google's end-to-end ML platform for building, training & deploying models.