خلية RNN التقليدية
انقل الحالة المخفية عبر الخطوات
خلية RNN التقليدية درس مجاني في Deep Learning Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Deep Learning Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
What a Cell Does
An RNN cell is the tiny engine that runs at each time step. You feed it one input and the old memory, and it returns the new memory.
Two Inputs Per Step
Every step the cell takes two things: the current input x and the previous hidden state. It mixes them into a fresh hidden state.
The Core Formula
The vanilla cell computes a weighted sum of input and memory, then squashes it. That single line is the heart of the RNN.
h_t = tanh(W_x @ x_t + W_h @ h_prev + b)Why tanh?
The tanh activation keeps the hidden state bounded between -1 and 1, so memory values stay stable instead of blowing up over many steps.
Two Weight Matrices
One matrix W_x reads the new input; another W_h reads the old memory. The cell learns both to decide what to keep and what to add.
The Initial Hidden State
Before step one there is no memory, so the hidden state starts as a vector of zeros and gets filled in as the sequence flows through.
h0 = torch.zeros(hidden_size)Unrolling Through Time
Picture the cell copied once per step, with memory passed along the chain. This view is called unrolling the network through time.
Outputs From Memory
Need a prediction at a step? Pass that step's hidden state through a small output layer to get logits or a value.
y_t = W_y @ h_t + b_yUse It in PyTorch
PyTorch gives you nn.RNN so you don't hand-code the loop. You set input and hidden sizes, then feed a batched sequence.
rnn = nn.RNN(input_size=10, hidden_size=20)Outputs and Final State
Calling the layer returns two things: the outputs at every step and the final hidden state, handy for classifying the whole sequence.
out, h_n = rnn(x)The Catch
Vanilla RNNs work, but their memory fades fast over long sequences. That weakness sets the stage for gated cells like the LSTM.
Quick Check
What two things does a vanilla RNN cell take as input each step?
Recap
The vanilla cell blends input and old memory with tanh to make a new hidden state, repeated step by step across the sequence. ✅
الأسئلة الشائعة
هل درس «خلية RNN التقليدية» مجاني؟
نعم — نص درس «خلية RNN التقليدية» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Deep Learning Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.
ماذا ستتعلم في «خلية RNN التقليدية»؟
انقل الحالة المخفية عبر الخطوات تتمرن على Deep Learning Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Deep Learning Academy؟
لا تُشترط خبرة سابقة. Deep Learning Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.
كم من الوقت يستغرق درس «خلية RNN التقليدية»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Deep Learning Academy هذا؟
نعم. كل درس في Deep Learning Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- لماذا تحتاج التسلسلات إلى ذاكرة
- خلية RNN التقليدية
- بوابات LSTM وGRU
- تجميع التسلسلات والتعامل مع Padding