use candle_core::{Result, Tensor};
pub struct TokenGather;
impl TokenGather {
pub fn forward(&self, hidden_states: &Tensor, word_indices: &Tensor) -> Result<Tensor> {
let h = hidden_states.squeeze(0)?;
let gathered = h.index_select(word_indices, 0)?;
gathered.unsqueeze(0)
}
}