Deep Learning Academy · درس

ReLU وشقيقتاها Leaky وGELU

دالة التنشيط الافتراضية والبدائل الحديثة

الدرس 2 من 413 خطوة

ReLU وشقيقتاها Leaky وGELU درس مجاني في Deep Learning Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 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. 🌟

البدء مجانًا

تعلم Python مع معلم ذكاء اصطناعي — مجانًا

اكتب وقم بتشغيل أكوادك الفعلية في المتصفح، واحصل على مساعدة فورية من معلم ذكاء اصطناعي متاح 24/7، واستمر من حيث توقفت على الويب أو في التطبيق.

الدورات
30
الدروس
120

الأسئلة الشائعة

هل درس «ReLU وشقيقتاها Leaky وGELU» مجاني؟

نعم — نص درس «ReLU وشقيقتاها Leaky وGELU» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Deep Learning Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.

ماذا ستتعلم في «ReLU وشقيقتاها Leaky وGELU»؟

دالة التنشيط الافتراضية والبدائل الحديثة تتمرن على Deep Learning Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Deep Learning Academy؟

لا تُشترط خبرة سابقة. Deep Learning Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.

كم من الوقت يستغرق درس «ReLU وشقيقتاها Leaky وGELU»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Deep Learning Academy هذا؟

نعم. كل درس في Deep Learning Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. لماذا تفتح اللاخطية المجال للقوة الحقيقية
  2. ReLU وشقيقتاها Leaky وGELU
  3. Sigmoid وTanh: حصر القيم ضمن نطاق
  4. Softmax للاحتمالات
← العودة إلى Deep Learning Academy