0Pricing
Deep Learning Academy · Aula

Portas LSTM e GRU

Lembre-se de dependências de longo alcance

Portas LSTM e GRU é uma aula grátis de Deep Learning Academy no CoddyKit. Esta é a aula 3 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Deep Learning Academy, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Deep Learning Academy inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

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

Perguntas Frequentes

A aula “Portas LSTM e GRU” é grátis?

Sim — o texto completo de “Portas LSTM e GRU” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Deep Learning Academy, atualize para CoddyKit PRO. O curso de Deep Learning Academy inclui 4 aulas no total.

O que vou aprender em “Portas LSTM e GRU”?

Lembre-se de dependências de longo alcance Você pratica Deep Learning Academy com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar Deep Learning Academy?

Nenhuma experiência prévia é necessária. Deep Learning Academy no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 3 de 4.

Quanto tempo leva a aula “Portas LSTM e GRU”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de Deep Learning Academy?

Sim. Cada aula de Deep Learning Academy inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. Por Que Sequências Precisam de Memória
  2. A Célula RNN Básica
  3. Portas LSTM e GRU
  4. Empacote Sequências e Lide com Preenchimento
← Voltar para Deep Learning Academy