Training 전체를 떠받치는 분리
TF엔 본질적으로 다른 두 컨테이너가 있어 — tf.constant (immutable)와 tf.Variable (mutable). 차이를 아는 게 필수야. training loop 전체가 이 위에 얹혀 있거든.
tf.constant는 read-only tensor. 입력 데이터, 하이퍼파라미터, 고정 lookup table용으로 딱.
tf.Variable은 mutable. assign, assign_add, assign_sub로 in-place 업데이트. 결정적으로 tf.Variable은 tf.GradientTape가 자동으로 watch해 — 이게 gradient 기반 파라미터 업데이트를 가능하게 만드는 핵심.
Keras의 모든 Dense, Conv2D layer weight가 tf.Variable이야. optimizer step마다 assign_sub가 호출돼. constant/Variable 구분이 곧 trainable/non-trainable 구분이라고 생각하면 돼.