skip to content

TensorFlow

TensorFlow covers the same ground as PyTorch with different defaults: tf.function graphs, tf.data input pipelines, Keras as the model API, tf.distribute for scale, and SavedModel plus TF Serving for deployment. Common wherever a production stack was built a few years ago.

on this pageshow

explore

questions

page 2 of 2

In tf.distribute, how do you choose between MirroredStrategy, MultiWorkerMirroredStrategy, and ParameterServerStrategy?

level: principalimportance: should knowfreq 38%

basics

~20 s

Match the hardware and the failure model: MirroredStrategy for several GPUs in one box, MultiWorkerMirroredStrategy for several machines with a good interconnect, ParameterServerStrategy when workers are asynchronous or preemptible. All three replicate the model, so none of them fits a model too large for one device.

open as a page

Should a TF 2.15 codebase set TF_USE_LEGACY_KERAS or migrate to Keras 3?

level: principalimportance: should knowfreq 30%

basics

~20 s

Decide by blast radius. TF_USE_LEGACY_KERAS=1 with the tf_keras package unblocks the TensorFlow upgrade in a day but pins you to a maintenance-only Keras 2. Treat it as a time-boxed bridge and schedule the Keras 3 migration behind it.

open as a page

When would you serve a SavedModel with TF Serving instead of a custom Python service?

level: principalimportance: should knowfreq 38%

basics

~20 s

TF Serving is worth it when the endpoint is mostly tensor math and you want versioning, request batching, warmup and a C++ runtime for free. A custom service wins when heavy Python-side logic surrounds the model and cannot move into the graph.

open as a page

When is eager execution the right default in a TensorFlow codebase?

level: principalimportance: should knowfreq 40%

basics

~20 s

Eager suits development, debugging, and code dominated by a few large ops or by dynamic Python, where graph optimization buys little. Graph execution earns its constraints where many small ops run in a hot loop, where XLA or an exported artifact is required, or where a Python interpreter cannot be in the path.

open as a page

When is a custom TensorFlow training loop worth its cost over the built-in fit loop?

level: principalimportance: should knowfreq 38%

basics

~20 s

Only when the step itself is genuinely non-standard — alternating optimizers, gradient surgery, higher-order gradients. A hand-written loop is not faster; it makes you re-own metric aggregation, validation, checkpoint cadence and logging, and every one of those is a place to introduce a silent bug.

open as a page

showing 31–35 of 35