pub struct RelativePositionEmbedding { /* private fields */ }Expand description
Embeds the signed sequence offset between a query residue and each of its spatial neighbours.
Implementations§
Source§impl RelativePositionEmbedding
impl RelativePositionEmbedding
Sourcepub fn load(vb: VarBuilder<'_>, d_model: usize) -> Result<Self>
pub fn load(vb: VarBuilder<'_>, d_model: usize) -> Result<Self>
Load the (66, d_model) table from <prefix>.embedding.weight.
Sourcepub fn forward(&self, query: &Tensor, key: &Tensor) -> Result<Tensor>
pub fn forward(&self, query: &Tensor, key: &Tensor) -> Result<Tensor>
query: (N,) centre residue indices. key: (N, K) neighbour
residue indices. Returns (N, K, d_model).
The offset is clamped to ±BINS and then shifted by BINS + 1, so an
offset of -BINS lands on row 1 and row 0 stays reserved for padding.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for RelativePositionEmbedding
impl !UnwindSafe for RelativePositionEmbedding
impl Freeze for RelativePositionEmbedding
impl Send for RelativePositionEmbedding
impl Sync for RelativePositionEmbedding
impl Unpin for RelativePositionEmbedding
impl UnsafeUnpin for RelativePositionEmbedding
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
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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