Podstawowa komórka RNN
Przenosić stan ukryty między kolejnymi krokami
Podstawowa komórka RNN to bezpłatna lekcja Deep Learning Academy na CoddyKit. To lekcja 2 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.
What a Cell Does
An RNN cell is the tiny engine that runs at each time step. You feed it one input and the old memory, and it returns the new memory.
Two Inputs Per Step
Every step the cell takes two things: the current input x and the previous hidden state. It mixes them into a fresh hidden state.
The Core Formula
The vanilla cell computes a weighted sum of input and memory, then squashes it. That single line is the heart of the RNN.
h_t = tanh(W_x @ x_t + W_h @ h_prev + b)Why tanh?
The tanh activation keeps the hidden state bounded between -1 and 1, so memory values stay stable instead of blowing up over many steps.
Two Weight Matrices
One matrix W_x reads the new input; another W_h reads the old memory. The cell learns both to decide what to keep and what to add.
The Initial Hidden State
Before step one there is no memory, so the hidden state starts as a vector of zeros and gets filled in as the sequence flows through.
h0 = torch.zeros(hidden_size)Unrolling Through Time
Picture the cell copied once per step, with memory passed along the chain. This view is called unrolling the network through time.
Outputs From Memory
Need a prediction at a step? Pass that step's hidden state through a small output layer to get logits or a value.
y_t = W_y @ h_t + b_yUse It in PyTorch
PyTorch gives you nn.RNN so you don't hand-code the loop. You set input and hidden sizes, then feed a batched sequence.
rnn = nn.RNN(input_size=10, hidden_size=20)Outputs and Final State
Calling the layer returns two things: the outputs at every step and the final hidden state, handy for classifying the whole sequence.
out, h_n = rnn(x)The Catch
Vanilla RNNs work, but their memory fades fast over long sequences. That weakness sets the stage for gated cells like the LSTM.
Quick Check
What two things does a vanilla RNN cell take as input each step?
Recap
The vanilla cell blends input and old memory with tanh to make a new hidden state, repeated step by step across the sequence. ✅
Często zadawane pytania
Czy lekcja „Podstawowa komórka RNN” jest bezpłatna?
Tak — pełny tekst „Podstawowa komórka RNN” 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 „Podstawowa komórka RNN”?
Przenosić stan ukryty między kolejnymi krokami Ć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 2 z 4.
Ile czasu zajmuje lekcja „Podstawowa komórka RNN”?
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
- Dlaczego sekwencje potrzebują pamięci
- Podstawowa komórka RNN
- Bramki LSTM i GRU
- Pakowanie sekwencji i obsługa paddingu