المرور الأمامي والخسارة والمرور العكسي والخطوة
الحركات الأربع لتكرار تدريبي واحد
المرور الأمامي والخسارة والمرور العكسي والخطوة درس مجاني في Deep Learning Academy على CoddyKit. هذا هو الدرس 1 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Deep Learning Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Four Moves, One Beat
Every training iteration is just four moves repeated: forward, loss, backward, step. Learn this rhythm and the whole training loop stops feeling mysterious. 🥁
Move One: Forward
The forward pass sends your input through the model so it produces a prediction. You just call the model on a batch of data and read the output.
pred = model(x)Logits, Not Answers Yet
The forward output is usually raw scores called logits, not clean labels. The loss function knows how to read these scores directly, so you leave them as is.
Move Two: Loss
Next you measure how wrong the prediction was. The loss compares your output to the true labels and boils the mistake down to one number.
loss = loss_fn(pred, y)Lower Loss, Better Model
A big loss means a poor prediction and a small one means a good prediction. Training has a single mission: drive this number steadily downward.
Move Three: Backward
Now you ask which way to nudge each weight. The backward pass uses autograd to compute every gradient and fill each parameter's .grad for you.
loss.backward()Gradients Are Directions
Each gradient tells you how the loss would change if you tweaked that one weight. They are the map the optimizer follows toward a better model.
Move Four: Step
Finally the optimizer applies those gradients, nudging every weight a little. This step is the moment the model actually learns from its mistake.
optimizer.step()Clear the Grads
Gradients pile up by default, so before the next backward you call zero_grad. Skip it and old gradients corrupt your next update.
optimizer.zero_grad()The Whole Move
Put the four moves together and you get one clean iteration. You will type this exact pattern in nearly every PyTorch project you build.
optimizer.zero_grad()
pred = model(x)
loss = loss_fn(pred, y)
loss.backward()
optimizer.step()Then Do It Again
Run these moves on batch after batch and the loss falls a little each time. Thousands of tiny updates are what turn random weights into real skill.
Quick Check
Which call actually computes the gradients for every weight?
Recap
One iteration is four moves: forward for a prediction, loss to measure error, backward for gradients, and step to update weights. Repeat to learn. 🎉
الأسئلة الشائعة
هل درس «المرور الأمامي والخسارة والمرور العكسي والخطوة» مجاني؟
نعم — نص درس «المرور الأمامي والخسارة والمرور العكسي والخطوة» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Deep Learning Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.
ماذا ستتعلم في «المرور الأمامي والخسارة والمرور العكسي والخطوة»؟
الحركات الأربع لتكرار تدريبي واحد تتمرن على Deep Learning Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Deep Learning Academy؟
لا تُشترط خبرة سابقة. Deep Learning Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 1 من أصل 4.
كم من الوقت يستغرق درس «المرور الأمامي والخسارة والمرور العكسي والخطوة»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Deep Learning Academy هذا؟
نعم. كل درس في Deep Learning Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- المرور الأمامي والخسارة والمرور العكسي والخطوة
- كتابة حلقة تدريب مصغّرة
- تتبّع الدقة أثناء التدريب
- وضعا Train وEval