0Pricing
Deep Learning Academy · Lektion

Batch Norm und Layer Norm

Stabilisieren Sie Aktivierungen, um tiefere Netze zu trainieren.

Batch Norm und Layer Norm ist eine kostenlose Deep Learning Academy-Lektion auf CoddyKit. Dies ist Lektion 3 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Deep Learning Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Deep Learning Academy-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

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. 🚀

Häufig gestellte Fragen

Ist die Lektion „Batch Norm und Layer Norm“ kostenlos?

Ja — der vollständige Text von „Batch Norm und Layer Norm“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Deep Learning Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Deep Learning Academy-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Batch Norm und Layer Norm“?

Stabilisieren Sie Aktivierungen, um tiefere Netze zu trainieren. Du übst Deep Learning Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um Deep Learning Academy zu starten?

Keine Vorkenntnisse erforderlich. Deep Learning Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 3 von 4.

Wie lange dauert die Lektion „Batch Norm und Layer Norm“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser Deep Learning Academy-Lektion Code schreiben und ausführen?

Ja. Jede Deep Learning Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Die Lücke zwischen Training und Validierung lesen
  2. Dropout: Neuronen zufällig auslassen
  3. Batch Norm und Layer Norm
  4. Data Augmentation als kostenlose Daten
← Zurück zu Deep Learning Academy