Deep Learning Academy · レッスン

ReLUとLeaky ReLU、GELUの仲間たち

標準的な活性化関数と、現代的なバリエーションを学びます

レッスン 2/413 ステップ

「ReLUとLeaky ReLU、GELUの仲間たち」はCoddyKit上の無料Deep Learning Academyレッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはDeep Learning Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Deep Learning Academyコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Meet ReLU

The most popular activation is ReLU: it keeps positive values and turns every negative one into zero. Simple and fast. ⚡

import torch.nn.functional as F
y = F.relu(x)   # max(0, x), elementwise

Why It Caught On

ReLU is cheap to compute and its gradient is a clean 1 for positives. That keeps signals flowing and makes deep nets train quickly.

The Math

ReLU is just max(0, x). Positive inputs pass straight through; negatives flatten to zero. That single hinge is the whole trick.

The Dying ReLU Problem

If a neuron always outputs zero, its gradient is zero too, so it stops learning forever. We call this a dead neuron. 💀

Leaky ReLU to the Rescue

Leaky ReLU lets a tiny slope through for negatives instead of a hard zero. That small leak keeps dead neurons alive.

y = F.leaky_relu(x, negative_slope=0.01)

Parametric ReLU

PReLU goes further: it learns the negative slope during training instead of fixing it. The network tunes the leak itself.

Meet GELU

GELU smooths the ReLU corner into a soft curve. It gates inputs by how likely they are to be useful, not with a hard cutoff.

y = F.gelu(x)

Why Transformers Love GELU

Modern models like transformers favor GELU because its smooth shape gives gentler gradients. That often means steadier training. 🤖

SiLU and Friends

SiLU, also called Swish, multiplies the input by its own sigmoid. Like GELU, it is smooth and frequently edges out plain ReLU.

A Sensible Default

Start with ReLU for hidden layers; it is fast and reliable. Reach for Leaky ReLU or GELU only if you see dead neurons or want extra smoothness.

Use It as a Layer

You can drop these in as modules inside a model, not just as functions. That makes them easy to chain in nn.Sequential.

import torch.nn as nn
net = nn.Sequential(nn.Linear(4, 8), nn.ReLU())

Quick Check

Think about a neuron that always lands in the negative zone.

Recap

ReLU is the fast default, but it can let neurons die. Leaky ReLU, PReLU, and GELU smooth or leak the negatives to keep learning healthy. 🌟

無料で開始

AI チューターと学ぶ Python — 無料

ブラウザでリアルコードを書いて実行し、24/7 の AI チューターから瞬時にサポートを受け、ウェブまたはアプリで続きから学習できます。

コース
30
レッスン
120

よくある質問

「ReLUとLeaky ReLU、GELUの仲間たち」レッスンは無料ですか?

はい。「ReLUとLeaky ReLU、GELUの仲間たち」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Deep Learning Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Deep Learning Academyコースには全4レッスンが含まれています。

「ReLUとLeaky ReLU、GELUの仲間たち」で何を学びますか?

標準的な活性化関数と、現代的なバリエーションを学びます ブラウザで直接実行するハンズオンコードでDeep Learning Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Deep Learning Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのDeep Learning Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン2/4です。

「ReLUとLeaky ReLU、GELUの仲間たち」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このDeep Learning Academyレッスンでコードを書いて実行できますか?

はい。すべてのDeep Learning Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. 非線形性が本当の力を引き出す理由
  2. ReLUとLeaky ReLU、GELUの仲間たち
  3. SigmoidとTanh:値を範囲に押し込む
  4. 確率のためのSoftmax
← Deep Learning Academyに戻る