docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거

Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
Antigravity Agent
2026-07-05 00:33:48 +09:00
parent 1cfd3bbb56
commit 9148c358d0
6455 changed files with 1 additions and 86875 deletions
@@ -0,0 +1,158 @@
---
id: wiki-2026-0508-tensorflow-foundations
title: TensorFlow Foundations
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [TensorFlow, TF2, Keras]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [tensorflow, deep-learning, keras]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: Python
framework: TensorFlow 2.x / Keras 3
---
# TensorFlow Foundations
## 매 한 줄
> **"매 production-first ML framework"**. Google이 2015년에 release한 graph-based deep learning framework. TF 2.x는 eager-by-default + Keras integration으로 PyTorch-like UX를 제공하지만, 매 핵심 강점은 mobile (TFLite) / web (TF.js) / production serving (TF Serving) 의 cross-platform deployment.
## 매 핵심
### 매 TF 2.x 의 essence
- **Eager execution** default — 매 `tf.function` 으로 graph compile (XLA / autograph).
- **Keras** 가 high-level API — 매 `tf.keras.Model` / `Sequential` / Functional API.
- **`tf.data`** — 매 efficient input pipeline (prefetch, parallel map, sharding).
- **`tf.distribute`** — 매 multi-GPU / TPU strategy (`MirroredStrategy`, `TPUStrategy`).
### 매 PyTorch 와 의 비교 (2026)
- **연구 share**: PyTorch ~85%, TF ~10%. JAX growing.
- **Production share**: TF still dominant (TFLite mobile, TF.js web, TF Serving) thanks to mature deployment.
- **Keras 3 (2024+)**: 매 backend-agnostic — TF / JAX / PyTorch 모두 backend로 사용 가능.
### 매 응용
1. Mobile inference (Android / iOS via TFLite).
2. Browser ML (TF.js — pose detection, on-device LLM).
3. Recommender systems (TFRS, large embedding tables).
## 💻 패턴
### Sequential model
```python
import tensorflow as tf
model = tf.keras.Sequential([
tf.keras.layers.Dense(128, activation="relu"),
tf.keras.layers.Dropout(0.2),
tf.keras.layers.Dense(10),
])
model.compile(optimizer="adam",
loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
metrics=["accuracy"])
model.fit(x_train, y_train, epochs=5, validation_split=0.1)
```
### Functional API (multi-input)
```python
img_in = tf.keras.Input(shape=(224, 224, 3))
txt_in = tf.keras.Input(shape=(128,), dtype="int32")
img_feat = tf.keras.applications.EfficientNetV2B0(include_top=False, pooling="avg")(img_in)
txt_feat = tf.keras.layers.Embedding(10000, 64)(txt_in)
txt_feat = tf.keras.layers.GlobalAveragePooling1D()(txt_feat)
x = tf.keras.layers.Concatenate()([img_feat, txt_feat])
out = tf.keras.layers.Dense(1, activation="sigmoid")(x)
model = tf.keras.Model([img_in, txt_in], out)
```
### tf.function (graph compile)
```python
@tf.function(jit_compile=True) # XLA
def train_step(x, y):
with tf.GradientTape() as tape:
logits = model(x, training=True)
loss = loss_fn(y, logits)
grads = tape.gradient(loss, model.trainable_variables)
optimizer.apply_gradients(zip(grads, model.trainable_variables))
return loss
```
### tf.data input pipeline
```python
ds = (tf.data.Dataset.from_tensor_slices((x, y))
.shuffle(10000)
.map(preprocess, num_parallel_calls=tf.data.AUTOTUNE)
.batch(64)
.prefetch(tf.data.AUTOTUNE))
```
### Multi-GPU
```python
strategy = tf.distribute.MirroredStrategy()
with strategy.scope():
model = build_model()
model.compile(...)
model.fit(ds, epochs=10)
```
### TFLite export
```python
converter = tf.lite.TFLiteConverter.from_keras_model(model)
converter.optimizations = [tf.lite.Optimize.DEFAULT] # int8 quantization
tflite_model = converter.convert()
open("model.tflite", "wb").write(tflite_model)
```
### Keras 3 backend swap
```python
import os
os.environ["KERAS_BACKEND"] = "jax" # or "torch", "tensorflow"
import keras
model = keras.Sequential([keras.layers.Dense(10)])
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| Mobile/edge deployment | TF + TFLite (mature) |
| Browser inference | TF.js |
| Production serving at scale | TF Serving / TFX |
| Research / new architectures | PyTorch (ecosystem) |
| Backend-agnostic code | Keras 3 |
| TPU training | TF or JAX |
**기본값**: 매 research 는 PyTorch, deployment 는 TF or ONNX export.
## 🔗 Graph
- 부모: [[Deep Learning]]
- 변형: [[PyTorch-Foundations]] · [[Keras]]
- 응용: [[Recommender-Systems]]
- Adjacent: [[Model-Serving]]
## 🤖 LLM 활용
**언제**: mobile/web deployment target, TPU access, legacy TF1 codebase migration, TFX pipeline.
**언제 X**: 매 cutting-edge research model 의 reproduce — 매 PyTorch reference impl 의 dominant.
## ❌ 안티패턴
- **TF1 graph mode 의 cling**: 매 `tf.compat.v1.Session` 의 use 를 새 code 에서 X — 매 TF2 eager + tf.function.
- **Custom training loop 의 unnecessary use**: 매 `model.fit` 으로 충분한 case 에 manual loop 작성.
- **`tf.py_function` overuse**: 매 graph 밖 fallback — 매 performance kill.
- **No `prefetch`**: 매 input pipeline 이 GPU 의 starve.
## 🧪 검증 / 중복
- Verified (TensorFlow official docs, Keras 3 release notes, 2024-2026 tracking).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — TF2/Keras3 modern usage + deployment focus |