MCPcopy Create free account
hub / github.com/RightNow-AI/TIDE / TokenRouter

Class TokenRouter

python/TIDE/router.py:11–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10
11class TokenRouter(nn.Module):
12 def __init__(self, hidden_dim: int, bottleneck_dim: int = 128):
13 super().__init__()
14 self.down = nn.Linear(hidden_dim, bottleneck_dim, bias=False)
15 self.up = nn.Linear(bottleneck_dim, 1, bias=False)
16 self.act = nn.SiLU()
17
18 def forward(self, hidden_state: torch.Tensor) -> torch.Tensor:
19 return torch.sigmoid(self.up(self.act(self.down(hidden_state)))).squeeze(-1)
20
21
22@dataclass

Callers 11

train_routersFunction · 0.90
tiny_runtimeFunction · 0.90
test_output_shapeMethod · 0.90
test_output_rangeMethod · 0.90
test_single_tokenMethod · 0.90
test_gradient_flowMethod · 0.90
loadMethod · 0.85

Calls

no outgoing calls

Tested by 9

tiny_runtimeFunction · 0.72
test_output_shapeMethod · 0.72
test_output_rangeMethod · 0.72
test_single_tokenMethod · 0.72
test_gradient_flowMethod · 0.72