Batch Norm และ Layer Norm
ทำให้ค่าการกระตุ้นเสถียรเพื่อฝึกโครงข่ายที่ลึกขึ้น
Batch Norm และ Layer Norm เป็นบทเรียน Deep Learning Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Deep Learning Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Deep Learning Academy มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
Why Normalize Activations
As signals flow through layers, their scale drifts and training slows. Normalization keeps activations in a stable, well-behaved range. ⚖️
Batch Norm in One Line
Batch normalization rescales each feature using the mean and variance computed across the current mini-batch.
Add Batch Norm
You drop in a batch norm layer after a linear or conv layer. Use nn.BatchNorm1d for dense features and BatchNorm2d for images.
self.bn = nn.BatchNorm1d(128)
x = torch.relu(self.bn(self.fc(x)))Learnable Scale and Shift
Batch norm adds two trainable parameters, gamma and beta, so the network can rescale and shift the normalized output as it needs.
It Lets You Train Deeper
By steadying activations, batch norm allows higher learning rates and deeper networks that would otherwise be hard to train.
Train vs Eval Stats
During training, batch norm uses batch statistics; at eval it switches to running averages, so call model.eval() before testing.
Batch Size Matters
Batch norm depends on the batch. With very small batches the statistics get noisy and the benefit can disappear.
Enter Layer Norm
Layer normalization normalizes across the features of a single sample, so it does not depend on the batch at all.
Add Layer Norm
Layer norm shines in transformers and RNNs. You add it with nn.LayerNorm, passing the size of the features to normalize.
self.ln = nn.LayerNorm(256)
x = self.ln(x)Same Behavior Both Modes
Because layer norm uses per-sample statistics, it behaves the same in training and eval, which suits variable batch sizes.
Which One to Pick
Reach for batch norm in conv vision models and layer norm in sequence and transformer models, where batches and lengths vary.
Quick Check
Recall the key difference between the two normalization styles.
Recap
You compared normalization: batch norm uses batch statistics and helps CNNs, while layer norm works per-sample and powers transformers. 🚀
คำถามที่พบบ่อย
บทเรียน “Batch Norm และ Layer Norm” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “Batch Norm และ Layer Norm” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Deep Learning Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Deep Learning Academy มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “Batch Norm และ Layer Norm”
ทำให้ค่าการกระตุ้นเสถียรเพื่อฝึกโครงข่ายที่ลึกขึ้น คุณปฏิบัติ Deep Learning Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Deep Learning Academy หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Deep Learning Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน
บทเรียน “Batch Norm และ Layer Norm” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Deep Learning Academy นี้ได้ไหม
ได้ บทเรียน Deep Learning Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- อ่านช่องว่างระหว่างชุดฝึกกับชุดตรวจสอบ
- Dropout: สุ่มตัดเซลล์ประสาท
- Batch Norm และ Layer Norm
- การเพิ่มข้อมูลเสมือนได้ข้อมูลเพิ่มฟรี