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

DistBelief에서 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

코드 보기 전에 이 이야기부터 알고 가야 해

TensorFlow는 진공 상태에서 태어난 게 아니야. Google Brain 안에서 그 전신이 DistBelief (2011)였거든. YouTube 썸네일로 그 유명한 Google Cat 네트워크를 훈련시킨 시스템. 강력했지만 Google 내부 infra에 너무 단단히 묶여 있어서 Mountain View 밖으로 나오질 못했어. 그래서 2015년 TensorFlow를 만들 때 mandate가 명확했지 — 연구자 laptop에서도, Google 데이터센터에서도, model을 다시 짜지 않고 그대로 돌릴 수 있는 시스템을 만들자.

초기 TF 1.x는 한 가지로 유명했어. 그래프 먼저, 실행은 나중에. tf.placeholdertf.Variable로 정적 graph 짜놓고, tf.Session 열어서 feed_dict 넣고 sess.run() 부르는 거야. 디버깅은 graph node를 print하는 거지, 값을 보는 게 아니었어. Python스럽지 않아도 너무 안 Python스러워서 한 세대의 연구자들이 그냥 PyTorch로 가버렸어. 2024–2026년에 읽는 ML paper들이 PyTorch default인 거, 그 시기 갈림길의 후폭풍이야.

이게 왜 중요하냐면: TF 2.x는 TF 1.x의 통증에 대한 응답이야. eager-by-default, tf.GradientTape, @tf.function 데코레이터, 다 Session이랑 placeholder가 망가뜨린 걸 고치려고 만든 거. 이 lens로 TF 2.x를 보면 디자인 선택들이 갑자기 다 말이 돼.

TensorFlow 2.0 (2019.9)은 완전 reset이었어. eager execution이 default가 되고, Keras가 공식 high-level API가 되고, production 속도 필요하면 @tf.function으로 graph 컴파일. 지금이 2026년 3월이고, 현재 stable은 TensorFlow 2.21.0이야. 이번 release 핵심: Python 3.9 지원 끝 (3.10+ 필수), TensorBoard 별도 설치 (pip install tensorboard), TFLite는 자기만의 LiteRT repo로 분리 진행 중.

Code

TF 1.x — the Session-based code you'll never write again·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-native, what you actually write·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

TF 깔린 Python REPL을 열어. tf.executing_eagerly() 돌려서 True 나오는지 확인. 그리고 tf.constant([1.0, 2.0]) + tf.constant([3.0, 4.0]) 계산해서 결과에 .numpy() 호출해. TF 1.x에선 이거 하려고 Session 열어야 했다는 거 체감해 봐.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.