0Pricing
Deep Learning Academy · درس

تكديس الطبقات الخطية

من الإدخال مرورًا بالمخفي إلى الخرج

تكديس الطبقات الخطية درس مجاني في Deep Learning Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Deep Learning Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

One Layer, One Transform

A single nn.Linear layer maps inputs to outputs with a weighted sum plus a bias. It reshapes data from one size to another.

layer = nn.Linear(in_features=4, out_features=8)

Input to Hidden

Your first layer takes the raw input features and projects them into a hidden space, often a larger or smaller width.

self.fc1 = nn.Linear(4, 16)   # 4 inputs -> 16 hidden

Hidden to Output

A later layer maps the hidden features down to your final output size, like the number of classes you want to predict.

self.fc2 = nn.Linear(16, 3)   # 16 hidden -> 3 classes

Chaining Sizes

Each layer's out_features must equal the next layer's in_features. These matching dimensions form a clean pipeline.

Add a Nonlinearity Between

Stacking bare linear layers stays linear, so place an activation like ReLU between them to unlock real depth.

x = F.relu(self.fc1(x))
x = self.fc2(x)

Width Versus Depth

More neurons per layer means more width; more layers means more depth. Both add capacity in different ways.

The Hidden Dimension Choice

Picking the hidden size is a design call. Bigger learns more patterns but costs memory and risks overfitting.

Data Flows Top to Bottom

In forward, the input passes through layer one, then the activation, then layer two. Each step transforms the tensor in turn.

def forward(self, x):
    x = F.relu(self.fc1(x))
    return self.fc2(x)

A Two-Layer MLP

Input, hidden, output with a nonlinearity is the classic multilayer perceptron. It is the workhorse of feedforward nets.

Parameters Grow With Layers

Every linear layer adds its own weights and bias. Stacking more layers steadily grows the model's parameter count.

Start Small, Then Grow

Begin with one hidden layer and expand only if needed. A lean stack trains fast and is easy to debug. 🌱

Quick Check

Recall what must sit between two linear layers to make stacking worthwhile.

Recap

Stack nn.Linear layers so each output size feeds the next input size, with an activation between them. That builds a real MLP. 🎯

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

هل درس «تكديس الطبقات الخطية» مجاني؟

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

ماذا ستتعلم في «تكديس الطبقات الخطية»؟

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

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

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

كم من الوقت يستغرق درس «تكديس الطبقات الخطية»؟

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

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

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

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

  1. توريث nn.Module: __init__ وforward
  2. تكديس الطبقات الخطية
  3. ‏nn.Sequential للنماذج السريعة
  4. فحص المعاملات وأشكال الطبقات
← العودة إلى Deep Learning Academy