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

ReLU และญาติอย่าง Leaky กับ GELU

ฟังก์ชันกระตุ้นมาตรฐานและรูปแบบสมัยใหม่

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

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

Meet ReLU

The most popular activation is ReLU: it keeps positive values and turns every negative one into zero. Simple and fast. ⚡

import torch.nn.functional as F
y = F.relu(x)   # max(0, x), elementwise

Why It Caught On

ReLU is cheap to compute and its gradient is a clean 1 for positives. That keeps signals flowing and makes deep nets train quickly.

The Math

ReLU is just max(0, x). Positive inputs pass straight through; negatives flatten to zero. That single hinge is the whole trick.

The Dying ReLU Problem

If a neuron always outputs zero, its gradient is zero too, so it stops learning forever. We call this a dead neuron. 💀

Leaky ReLU to the Rescue

Leaky ReLU lets a tiny slope through for negatives instead of a hard zero. That small leak keeps dead neurons alive.

y = F.leaky_relu(x, negative_slope=0.01)

Parametric ReLU

PReLU goes further: it learns the negative slope during training instead of fixing it. The network tunes the leak itself.

Meet GELU

GELU smooths the ReLU corner into a soft curve. It gates inputs by how likely they are to be useful, not with a hard cutoff.

y = F.gelu(x)

Why Transformers Love GELU

Modern models like transformers favor GELU because its smooth shape gives gentler gradients. That often means steadier training. 🤖

SiLU and Friends

SiLU, also called Swish, multiplies the input by its own sigmoid. Like GELU, it is smooth and frequently edges out plain ReLU.

A Sensible Default

Start with ReLU for hidden layers; it is fast and reliable. Reach for Leaky ReLU or GELU only if you see dead neurons or want extra smoothness.

Use It as a Layer

You can drop these in as modules inside a model, not just as functions. That makes them easy to chain in nn.Sequential.

import torch.nn as nn
net = nn.Sequential(nn.Linear(4, 8), nn.ReLU())

Quick Check

Think about a neuron that always lands in the negative zone.

Recap

ReLU is the fast default, but it can let neurons die. Leaky ReLU, PReLU, and GELU smooth or leak the negatives to keep learning healthy. 🌟

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

บทเรียน “ReLU และญาติอย่าง Leaky กับ GELU” ฟรีหรือไม่

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

คุณจะเรียนรู้อะไรในบทเรียน “ReLU และญาติอย่าง Leaky กับ GELU”

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

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

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

บทเรียน “ReLU และญาติอย่าง Leaky กับ GELU” ใช้เวลานานแค่ไหน

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

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

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

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

  1. เหตุใดความไม่เป็นเชิงเส้นจึงปลดล็อกพลังที่แท้จริง
  2. ReLU และญาติอย่าง Leaky กับ GELU
  3. Sigmoid และ Tanh: บีบค่าให้อยู่ในช่วง
  4. Softmax สำหรับความน่าจะเป็น
← กลับไปที่ Deep Learning Academy