AI Terms Dictionary

A comprehensive multilingual AI terminology dictionary

Definition

A Gated Recurrent Unit (GRU) is a specialized recurrent neural network (RNN) cell designed to capture long-term dependencies in sequential data. It simplifies the Long Short-Term Memory (LSTM) architecture by combining the forget and input gates into a single update gate and merging the cell state and hidden state. This results in fewer parameters and faster training while maintaining competitive performance in tasks like language modeling and time-series prediction.

Summary

A type of recurrent neural network architecture that uses gating mechanisms to control the flow of information, serving as a simplified alternative to LSTM.

Key Concepts

Use Cases

Code Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import torch.nn as nn

# Define a simple GRU layer
gru = nn.GRU(input_size=10, hidden_size=20, num_layers=1)

# Example input: (seq_len, batch, input_size)
input_data = torch.randn(5, 3, 10)
hidden_state = None

output, hidden = gru(input_data, hidden_state)