0Pricing
Deep Learning Academy · บทเรียน

เกรเดียนต์หายและเกรเดียนต์ระเบิด

สิ่งที่ทำให้โครงข่ายลึกเสียหายและวิธีแก้ไขในยุคแรก

เกรเดียนต์หายและเกรเดียนต์ระเบิด เป็นบทเรียน Deep Learning Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Deep Learning Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Deep Learning Academy มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

Gradients Are a Product

Through many layers, backprop multiplies many local derivatives together. The size of that long product decides whether learning works or breaks.

Multiplying Small Numbers

If each link's derivative is below one, the product shrinks fast. After many layers the gradient becomes tiny, almost zero by the time it reaches early layers.

That Is Vanishing Gradients

When gradients shrink to near zero, early layers barely update and stop learning. This is the vanishing gradient problem that long stalled deep nets.

Multiplying Big Numbers

If each derivative is above one, the product blows up instead. Gradients grow huge as they travel back, and the weights lurch wildly.

That Is Exploding Gradients

Runaway gradients are the exploding gradient problem. Loss often jumps to NaN as updates overshoot far past any useful value. 💥

Sigmoid Made It Worse

Sigmoid and tanh squash inputs, so their derivatives stay well below one. Stacking them multiplied small numbers and made vanishing gradients common.

ReLU to the Rescue

ReLU has a derivative of exactly one for positive inputs, so it does not shrink the gradient. Switching to ReLU was a key early fix.

relu_grad = 1.0 if x > 0 else 0.0

Careful Weight Initialization

Smart schemes like Xavier and He initialization scale starting weights so the gradient product stays near one across many layers.

Clip Exploding Gradients

For explosions, gradient clipping caps the gradient's size before the update, keeping a single huge step from wrecking the model.

torch.nn.utils.clip_grad_norm_(model.parameters(), 1.0)

Skip Connections Help

ResNet adds skip connections that let gradients flow straight back, sidestepping the long chain of multiplications that causes vanishing.

Why It All Matters

Keeping the gradient product near one is what lets very deep nets train at all. Every fix here exists to protect that balance.

Quick Check

Let's check the failure modes.

Recap

Long products of derivatives can vanish or explode. ReLU, careful init, clipping, and skip connections keep gradients healthy through deep nets. 💥

คำถามที่พบบ่อย

บทเรียน “เกรเดียนต์หายและเกรเดียนต์ระเบิด” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “เกรเดียนต์หายและเกรเดียนต์ระเบิด” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Deep Learning Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Deep Learning Academy มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “เกรเดียนต์หายและเกรเดียนต์ระเบิด”

สิ่งที่ทำให้โครงข่ายลึกเสียหายและวิธีแก้ไขในยุคแรก คุณปฏิบัติ Deep Learning Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Deep Learning Academy หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Deep Learning Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน

บทเรียน “เกรเดียนต์หายและเกรเดียนต์ระเบิด” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Deep Learning Academy นี้ได้ไหม

ได้ บทเรียน Deep Learning Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. กฎลูกโซ่ทีละชั้น
  2. การส่งต่อเก็บแคช การย้อนกลับนำกลับมาใช้
  3. ทำการแพร่ย้อนกลับของโครงข่ายเล็ก ๆ ด้วยมือ
  4. เกรเดียนต์หายและเกรเดียนต์ระเบิด
← กลับไปที่ Deep Learning Academy