C.W.K.
Stream
Lesson 01 of 07 · published

From DistBelief to TensorFlow 2.21

~12 min · history, tf2, eager

Level 0Level 0
0 XP0/78 lessons0/17 achievements
0/100 XP to next level100 XP to go0% complete

Why this story matters before any code

TensorFlow wasn't designed in a vacuum. Inside Google Brain, the predecessor was DistBelief (2011) — the system that trained the famous Google Cat network on YouTube thumbnails. DistBelief was powerful but tightly coupled to internal Google infrastructure, which is why it never escaped Mountain View. TensorFlow's 2015 mandate was explicit: a system that could run on a researcher's laptop and on a Google datacenter without rewriting the model.

Early TensorFlow (1.x) was famous for one thing: graphs first, execution later. You declared a static graph using tf.placeholder and tf.Variable, then opened a tf.Session and called sess.run() with a feed_dict. Debugging meant printing graph nodes, not values. The mental model was so foreign to Python that an entire generation of researchers picked PyTorch instead — and a lot of the ML papers you read in 2024–2026 still default to PyTorch because of that early fork in adoption.

Why this matters: TF 2.x is a response to TF 1.x's pain. Eager-by-default execution, tf.GradientTape, and the @tf.function decorator all exist because Sessions and placeholders were a deal-breaker. Read TF 2.x design choices through this lens and they stop looking arbitrary.

TensorFlow 2.0 (Sept 2019) was a hard reset: eager execution by default, Keras as the official high-level API, @tf.function as the bridge between eager Python and compiled graphs when you need production speed. As of March 2026, the current stable is TensorFlow 2.21.0. Notable in this release: Python 3.9 support is dropped (3.10+ required), TensorBoard ships separately (pip install tensorboard), and TFLite is being extracted into its own LiteRT repository.

Code

TF 1.x — Session 기반, 더 이상 안 쓸 코드·python
import tensorflow as tf  # TF 1.x

x = tf.placeholder(tf.float32, shape=[None, 784])
W = tf.get_variable("W", shape=[784, 10])
b = tf.get_variable("b", shape=[10])

logits = tf.matmul(x, W) + b
loss = tf.reduce_mean(
    tf.nn.softmax_cross_entropy_with_logits(
        labels=y_placeholder, logits=logits))
train_op = tf.train.GradientDescentOptimizer(0.01).minimize(loss)

with tf.Session() as sess:
    sess.run(tf.global_variables_initializer())
    for step in range(1000):
        sess.run(train_op,
                 feed_dict={x: x_data, y_placeholder: y_data})
TF 2.x — Python 자연스러운 코드·python
import tensorflow as tf

model = tf.keras.Sequential([
    tf.keras.layers.Dense(10, input_shape=(784,))
])

model.compile(
    optimizer=tf.keras.optimizers.SGD(learning_rate=0.01),
    loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
    metrics=['accuracy'],
)
history = model.fit(x_data, y_data, epochs=10, batch_size=32)

External links

Exercise

Open a Python REPL with TF installed. Run tf.executing_eagerly() — confirm it's True. Then compute tf.constant([1.0, 2.0]) + tf.constant([3.0, 4.0]) and call .numpy() on the result. Notice how this would have required a Session in TF 1.x.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.