from __future__ import annotations import torch import torch.nn as nn class ScoreAggregator(nn.Module): """Aggregate concept vector into scalar score in [0, 100].""" def __init__(self, k: int = 6): super().__init__() self.mlp = nn.Sequential( nn.Linear(k, 32), nn.GELU(), nn.Linear(32, 1), nn.Sigmoid(), ) def forward(self, concepts: torch.Tensor) -> torch.Tensor: return self.mlp(concepts) * 100.0