DEEP LEARNING FRAMEWORK
TensorFlow Tutorials
TensorFlow is the engine under Keras and the framework a lot of production machine learning still runs on. These 39 tutorials cover tensors, neural networks, data pipelines and the version-mismatch errors that stop people on day one.
- 39 tutorials
- 7 topics
- TF 2.x
What TensorFlow is for
TensorFlow is Google’s deep learning framework. Its core idea is the tensor: a multi-dimensional array, much like a NumPy array, except that TensorFlow can track every operation performed on it and work backwards to compute gradients. That automatic differentiation is what makes training a neural network possible without writing calculus by hand.
In practice you rarely touch that machinery directly, because you build models with Keras and TensorFlow does the work underneath. Where you do meet TensorFlow itself is in the surrounding pipeline — tf.data for feeding data in efficiently, TensorBoard for watching training, and the export formats used for deployment.
One warning worth having up front. TensorFlow 1 and TensorFlow 2 are different enough that old code does not run, and a great many tutorials online were written for version 1. If an example uses tf.Session(), tf.placeholder() or tf.global_variables_initializer(), it is TF1 code. That single fact explains most of the errors in the section below.
Install it and check the version
One pip install gives you TensorFlow and Keras together. If you have an NVIDIA GPU and want to use it, install the CUDA-enabled build and check that TensorFlow can actually see the device — a silent fallback to CPU is a common surprise.
Before following any tutorial, print your version. Knowing whether you are on 2.x, and how recent, resolves most of the mismatches between what you type and what the tutorial expected.
AttributeError: module 'tensorflow' has no attribute 'placeholder' means you are running TensorFlow 1 code on TensorFlow 2. Placeholders and sessions no longer exist — TF2 runs eagerly. Find a TF2 version of the example rather than adding compatibility shims.
If you are starting today
A sensible order to learn TensorFlow in
Five steps. Tensors first, then a network, then the data pipeline that feeds it.
- 1
Understand tensors
Shapes, dtypes and the conversion to and from NumPy arrays you will do constantly.
- 2
Meet variables and shapes
The difference between a constant and a trainable variable, and how to read
get_shape(). - 3
Build a neural network
Layers, activations and the compile step, using Keras on top of TensorFlow.
- 4
Train it
Loss functions, gradient descent and what actually happens during an epoch.
- 5
Feed it properly
tf.datafor batching, shuffling and prefetching once the dataset stops fitting in memory.
Quick reference
The TensorFlow calls you will use most
Ten lines covering tensors, shapes and the pipeline around a model.
| Task | Code | Worth knowing |
|---|---|---|
| Create a tensor | tf.constant([[1.0, 2.0]]) | Immutable. Use for fixed data. |
| Trainable variable | tf.Variable(0.0) | What the optimizer updates during training. |
| Check the shape | x.shape | The first thing to print when something breaks. |
| To a NumPy array | x.numpy() | Works because TF2 runs eagerly. |
| From a NumPy array | tf.convert_to_tensor(arr) | Dtypes carry over, so check them. |
| Change dtype | tf.cast(x, tf.float32) | Mixing int and float tensors raises errors. |
| Reshape | tf.reshape(x, (2, -1)) | -1 means infer this dimension. |
| Sum | tf.reduce_sum(x, axis=0) | The reduce_* family replaces NumPy’s methods. |
| Dataset from arrays | tf.data.Dataset.from_tensor_slices((x, y)) | The start of every input pipeline. |
| Batch and prefetch | .batch(32).prefetch(tf.data.AUTOTUNE) | Keeps the GPU fed while the CPU loads. |
Every tutorial, by topic
Every TensorFlow tutorial, grouped by what you are trying to do
Sorted into seven topics rather than the single list this page used to be, with the version-mismatch errors pulled out at the top where people need them.
Errors and fixes
10Almost all of these are the same underlying problem: TensorFlow 1 code running on TensorFlow 2, so placeholder, Session, log and optimizers appear to be missing. Start here if an AttributeError names something that should obviously exist.
Install and setup
3Installing TensorFlow, upgrading to the current version, and getting it working inside Jupyter — where a second Python install is usually the culprit.
Getting started
3What TensorFlow is made of, how the wider ecosystem fits together, and an introduction to the 3.x line.
Neural networks
6Building, compiling and training networks, including convolutional ones, plus how gradient descent moves the weights.
Layers and activations
3Fully connected layers, batch normalisation and the activation functions that sit between layers.
Tensors and operations
6Creating tensors and variables, reading shapes, iterating, converting types, and moving back and forth between tensors and NumPy arrays.
More TensorFlow tutorials
8Data pipelines with tf.data, TensorBoard, debugging models, cross-entropy loss, the TensorFlow-versus-PyTorch question and interview preparation.
Keep going
What to learn next to it
TensorFlow is rarely the only thing on screen. These are the libraries around it.
Questions people ask
Frequently asked questions
Should I learn TensorFlow or Keras?
They are not alternatives. Keras is the high-level API you write models with, and TensorFlow is what runs them. Learn Keras for building models, and enough TensorFlow to handle tensors, tf.data pipelines and deployment.
Why does tf.placeholder not exist?
Because it was removed in TensorFlow 2. Placeholders and tf.Session belong to TF1’s graph-first design; TF2 runs eagerly, so you pass real tensors straight to functions. Any tutorial using them predates 2019 and needs replacing rather than patching.
Is TensorFlow still used in 2026?
Yes, particularly in production. PyTorch dominates research and papers, but TensorFlow’s serving, mobile and browser deployment story keeps it common in industry, and a lot of existing systems run on it.
What is the difference between a tensor and a NumPy array?
For everyday use, very little — both are typed multi-dimensional arrays, and x.numpy() converts between them. The differences that matter are that tensors can live on a GPU and that TensorFlow records operations on them so it can compute gradients.
Do I need a GPU for TensorFlow?
Not to learn. Small models train fine on a CPU. A GPU becomes worthwhile for larger images, transformers or datasets that take hours — and Colab or Kaggle give you one free before you spend anything.
Why does TensorFlow not see my GPU?
Usually a version mismatch between TensorFlow, CUDA and cuDNN, or the CPU-only wheel being installed. Run tf.config.list_physical_devices('GPU') — an empty list means TensorFlow will silently use the CPU, so check your build and driver versions against the official compatibility table.
Make a tensor, then train something with it
Print a shape, convert it to NumPy and back, then build a small network. That is the whole foundation.
