Batch NormとLayer Norm
活性化を安定させて、より深いモデルを学習します
「Batch NormとLayer Norm」はCoddyKit上の無料Deep Learning Academyレッスンです。 これはレッスン3/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはDeep Learning Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Deep Learning Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
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. 🚀
よくある質問
「Batch NormとLayer Norm」レッスンは無料ですか?
はい。「Batch NormとLayer Norm」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Deep Learning Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Deep Learning Academyコースには全4レッスンが含まれています。
「Batch NormとLayer Norm」で何を学びますか?
活性化を安定させて、より深いモデルを学習します ブラウザで直接実行するハンズオンコードでDeep Learning Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Deep Learning Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのDeep Learning Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン3/4です。
「Batch NormとLayer Norm」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このDeep Learning Academyレッスンでコードを書いて実行できますか?
はい。すべてのDeep Learning Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- 学習用と検証用の差を読み取る
- Dropout:ニューロンをランダムに無効化する
- Batch NormとLayer Norm
- 無料でデータを増やすデータ拡張