Normalisation par lots et normalisation par couche
Stabilisez les activations pour entraîner des réseaux plus profonds.
Normalisation par lots et normalisation par couche est une leçon Deep Learning Academy gratuite sur CoddyKit. Ceci est la leçon 3 sur 4. Tu peux lire la leçon complète ci-dessous gratuitement — puis la pratiquer en direct dans le navigateur avec un éditeur de code intégré et un tuteur IA 24/7. Elle fait partie du parcours d'apprentissage Deep Learning Academy, et ta progression se synchronise sur le web et l'application CoddyKit. Le cours Deep Learning Academy comprend 4 leçons au total.
Certaines parties de cette leçon n'ont pas encore été traduites et s'affichent en anglais.
Why Normalize Activations
As signals flow through layers, their scale drifts and training slows. Normalization keeps activations in a stable, well-behaved range. ⚖️
Batch Norm in One Line
Batch normalization rescales each feature using the mean and variance computed across the current mini-batch.
Add Batch Norm
You drop in a batch norm layer after a linear or conv layer. Use nn.BatchNorm1d for dense features and BatchNorm2d for images.
self.bn = nn.BatchNorm1d(128)
x = torch.relu(self.bn(self.fc(x)))Learnable Scale and Shift
Batch norm adds two trainable parameters, gamma and beta, so the network can rescale and shift the normalized output as it needs.
It Lets You Train Deeper
By steadying activations, batch norm allows higher learning rates and deeper networks that would otherwise be hard to train.
Train vs Eval Stats
During training, batch norm uses batch statistics; at eval it switches to running averages, so call model.eval() before testing.
Batch Size Matters
Batch norm depends on the batch. With very small batches the statistics get noisy and the benefit can disappear.
Enter Layer Norm
Layer normalization normalizes across the features of a single sample, so it does not depend on the batch at all.
Add Layer Norm
Layer norm shines in transformers and RNNs. You add it with nn.LayerNorm, passing the size of the features to normalize.
self.ln = nn.LayerNorm(256)
x = self.ln(x)Same Behavior Both Modes
Because layer norm uses per-sample statistics, it behaves the same in training and eval, which suits variable batch sizes.
Which One to Pick
Reach for batch norm in conv vision models and layer norm in sequence and transformer models, where batches and lengths vary.
Quick Check
Recall the key difference between the two normalization styles.
Recap
You compared normalization: batch norm uses batch statistics and helps CNNs, while layer norm works per-sample and powers transformers. 🚀
Questions Fréquemment Posées
La leçon « Normalisation par lots et normalisation par couche » est-elle gratuite ?
Oui — le texte complet de « Normalisation par lots et normalisation par couche » est gratuit à lire ici sur le web. Pour la pratiquer de manière interactive (un éditeur de code intégré et un tuteur IA 24/7) et déverrouiller le reste du cours Deep Learning Academy, passe à CoddyKit PRO. Le cours Deep Learning Academy comprend 4 leçons au total.
Qu'est-ce que j'apprendrai dans « Normalisation par lots et normalisation par couche » ?
Stabilisez les activations pour entraîner des réseaux plus profonds. Tu pratiques Deep Learning Academy avec du code pratique que tu exécutes directement dans le navigateur, et un tuteur IA 24/7 répond à tes questions au fur et à mesure que tu avances dans la leçon.
Dois-je avoir de l'expérience pour commencer Deep Learning Academy ?
Aucune expérience préalable n'est requise. Deep Learning Academy sur CoddyKit est structuré pour les débutants jusqu'aux apprenants avancés, donc tu peux commencer ici ou depuis le début et avancer à ton rythme. Ceci est la leçon 3 sur 4.
Combien de temps prend la leçon « Normalisation par lots et normalisation par couche » ?
La plupart des leçons CoddyKit prennent environ 5–10 minutes. Chacune est courte et interactive, tu progresses régulièrement et tu repiques exactement où tu t'es arrêté sur le web et l'app.
Peux-tu écrire et exécuter du code dans cette leçon Deep Learning Academy ?
Oui. Chaque leçon Deep Learning Academy inclut un éditeur de code intégré, tu écris et exécutes du vrai code directement dans ton navigateur et tu reçois des retours IA instantanés — aucune configuration locale requise.
Toutes les leçons de ce cours
- Interpréter l’écart entraînement-validation
- Dropout : supprimer des neurones aléatoirement
- Normalisation par lots et normalisation par couche
- L’augmentation des données comme données gratuites