Spaces:
Running
Running
| import torch | |
| import torch.nn as nn | |
| class ProgrammingEmbedding(nn.Module): | |
| """ | |
| Maps sentence vectors into programming-related feature space. | |
| """ | |
| def __init__(self, input_dim: int = 128, hidden_dim: int = 128): | |
| super().__init__() | |
| self.network = nn.Sequential( | |
| nn.Linear(input_dim, hidden_dim), | |
| nn.ReLU(), | |
| nn.LayerNorm(hidden_dim) | |
| ) | |
| def forward(self, x: torch.Tensor) -> torch.Tensor: | |
| return self.network(x) |