pub struct Surprisal {
pub bits: Vec<f32>,
pub top: Vec<u32>,
pub top_p: Vec<f32>,
}Expand description
Per-position surprisal from Gpt2::surprisal_async. All three vectors are
the length of the input, and index 0 is a placeholder in each — nothing
precedes the first token.
Fields§
§bits: Vec<f32>-log2 p(ids[i] | ids[..i]), in bits.
top: Vec<u32>The token the model would have chosen at this position.
top_p: Vec<f32>How probable the model thought its own choice was, in 0..=1.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Surprisal
impl RefUnwindSafe for Surprisal
impl Send for Surprisal
impl Sync for Surprisal
impl Unpin for Surprisal
impl UnsafeUnpin for Surprisal
impl UnwindSafe for Surprisal
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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