エンコーダー
term_id: encoder
Category: basic_concepts
Definition
エンコーダーは生の入力シーケンスやデータ構造を処理し、潜在空間表現(エンベッディングやコードと呼ばれることが多い)に変換します。これらはTransformerやオートエンコーダーなどのアーキテクチャの中核をなしています。
Summary
エンコーダーは、入力データを圧縮され、意味のある表現に変換するニューラルネットワークの構成要素です。
Key Concepts
- 特徴抽出
- 潜在空間
- シーケンス処理
- 圧縮
Use Cases
- Transformerモデルでの入力テキストの処理
- ノイズ除去用のオートエンコーダーにおける画像の圧縮
- レビューからの感情特徴の抽出
Code Example
import torch.nn as nn
class SimpleEncoder(nn.Module):
def __init__(self, input_dim, hidden_dim):
super().__init__()
self.fc = nn.Linear(input_dim, hidden_dim)
def forward(self, x):
return torch.relu(self.fc(x))