0Pricing
Deep Learning Academy · Lekcja

Bramki LSTM i GRU

Zapamiętywać zależności dalekiego zasięgu

Bramki LSTM i GRU to bezpłatna lekcja Deep Learning Academy na CoddyKit. To lekcja 3 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej Deep Learning Academy, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs Deep Learning Academy zawiera 4 lekcji w sumie.

Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.

The Long-Memory Problem

Vanilla RNNs forget early clues over long sequences. Gated cells fix this by deciding what to keep, update, or throw away.

Meet the LSTM

The LSTM adds a separate cell state, a memory highway that runs straight across time with only small, controlled edits.

Gates Are Soft Switches

A gate is a sigmoid layer outputting values from 0 to 1. Zero blocks information, one lets it pass, and in between mixes the two.

gate = torch.sigmoid(W @ x + U @ h)

The Forget Gate

The forget gate looks at the input and memory and chooses which parts of the old cell state to erase before adding anything new.

The Input Gate

The input gate decides how much of the fresh candidate information should be written into the cell state at this step.

The Output Gate

The output gate controls how much of the updated cell state becomes the visible hidden state passed to the next step. 🚪

Why Gates Help Gradients

Because the cell state changes gently, gradients flow back across many steps without vanishing, so the model learns long-range patterns.

Meet the GRU

The GRU is a lighter cousin: it merges gates and drops the separate cell state, giving similar power with fewer parameters.

GRU's Two Gates

A GRU uses just two gates, a reset gate and an update gate, to balance old memory against new input each step.

Drop-In in PyTorch

Both are one-liners in PyTorch. Swap nn.LSTM or nn.GRU for nn.RNN and keep almost the same training code.

lstm = nn.LSTM(input_size=10, hidden_size=20)

Which to Choose?

GRUs are faster and often match LSTMs; LSTMs can edge ahead on the hardest long sequences. Try both and let your validation score decide.

Quick Check

What is the job of the forget gate in an LSTM?

Recap

LSTMs and GRUs use gates to control memory, letting gradients survive long sequences and capturing far-apart dependencies. ✅

Często zadawane pytania

Czy lekcja „Bramki LSTM i GRU” jest bezpłatna?

Tak — pełny tekst „Bramki LSTM i GRU” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu Deep Learning Academy, przejdź na CoddyKit PRO. Kurs Deep Learning Academy zawiera 4 lekcji w sumie.

Co nauczysz się w „Bramki LSTM i GRU”?

Zapamiętywać zależności dalekiego zasięgu Ćwiczysz Deep Learning Academy z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.

Czy potrzebuję doświadczenia, aby zacząć Deep Learning Academy?

Nie wymagamy żadnego doświadczenia. Deep Learning Academy w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 3 z 4.

Ile czasu zajmuje lekcja „Bramki LSTM i GRU”?

Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.

Czy mogę pisać i uruchamiać kod w tej lekcji Deep Learning Academy?

Tak. Każda lekcja Deep Learning Academy zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.

Wszystkie lekcje w tym kursie

  1. Dlaczego sekwencje potrzebują pamięci
  2. Podstawowa komórka RNN
  3. Bramki LSTM i GRU
  4. Pakowanie sekwencji i obsługa paddingu
← Powrót do Deep Learning Academy