pub struct SharedScorer { /* private fields */ }Expand description
One shared linear scorer over anchor-token hidden states: a single
d_model → 1 projection applied to every anchor position, of every option, of
every question. Trained weights live in a [nn::VarStore] so checkpoints attach to
the converted backbone in P1.2 without a format boundary.
Implementations§
Sourcepub fn new(vs: &VarStore, hidden_dim: i64) -> Self
pub fn new(vs: &VarStore, hidden_dim: i64) -> Self
Create the scorer under vs.root() with the backbone’s hidden size.
Sourcepub fn forward(
&self,
hidden: &Tensor,
batch_anchors: &[Vec<QuestionAnchors>],
) -> Result<Vec<Vec<QuestionScore>>, Error>
pub fn forward( &self, hidden: &Tensor, batch_anchors: &[Vec<QuestionAnchors>], ) -> Result<Vec<Vec<QuestionScore>>, Error>
Score every question of every sequence in the batch.
hidden is the backbone’s final hidden states, [batch, tokens, d_model];
batch_anchors is one anchor map list per batch row (from
crate::encoder::DecisionEncoder::encode). Each question’s logits are the
projection of its own anchor states — structurally identical per option, which
is what makes option-order permutation a data-side concern (S6b1) rather than
an architectural one.
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more