EffectiveTensorflow
TensorFlow tutorials and best practices.
A written guide with Python code examples that explains TensorFlow 2 concepts like tensors, broadcasting, control flow, and numerical stability for programmers who already know Python.
Effective TensorFlow 2 is a written guide for people learning to build machine learning programs using TensorFlow 2, a popular open-source library for numerical computation and training neural networks. The guide is structured as a series of articles, each focused on a specific concept, with Python code examples throughout.
TensorFlow is a tool that lets programmers describe mathematical operations (like matrix multiplication or curve fitting) and then run those operations efficiently on CPUs, GPUs, or TPUs. Version 2 of TensorFlow changed how the library is used day to day: instead of first building a static description of a computation and then running it separately (as version 1 required), version 2 executes operations immediately like a standard Python program would. The guide explains how this works and how the two modes compare.
The topics covered in the guide include the basics of how tensors (multi-dimensional arrays of numbers) work in TensorFlow, broadcasting (a shortcut that lets operations work on arrays of different shapes without copying data), overloaded operators (using standard Python math symbols like + and * directly on tensors), and control flow (using if statements and loops inside TensorFlow computations). Later sections cover numerical stability (avoiding errors that come from very large or very small numbers during training) and how to write custom Python operations that integrate with TensorFlow's system.
Each section is self-contained and walks through a concrete example. The guide is aimed at programmers who already know Python and want to understand TensorFlow well enough to use it correctly, rather than just copy-paste working code. The original version of the guide covered TensorFlow 1.x and is preserved on a separate branch of the repository.
The guide is not a finished course with exercises or certificates. It is a reference document that the author has updated as TensorFlow's API changed.
Where it fits
- Learn how TensorFlow 2 eager execution differs from version 1 static graphs with side-by-side code examples.
- Understand broadcasting rules to write tensor operations on arrays of different shapes without data copying.
- Write a custom TensorFlow 2 operation in Python that integrates correctly with automatic differentiation.