pub struct ProjectionHead { /* private fields */ }Expand description
Two-layer MLP projection head used in contrastive learning.
Architecture: in_dim → hidden_dim (ReLU) → out_dim
Implementations§
Source§impl ProjectionHead
impl ProjectionHead
Sourcepub fn new(in_dim: usize, hidden_dim: usize, out_dim: usize, seed: u64) -> Self
pub fn new(in_dim: usize, hidden_dim: usize, out_dim: usize, seed: u64) -> Self
Construct a new projection head with Xavier-uniform initialised weights.
§Arguments
in_dim– input dimension (encoder output size)hidden_dim– hidden layer dimensionout_dim– projection output dimensionseed– RNG seed
Auto Trait Implementations§
impl Freeze for ProjectionHead
impl RefUnwindSafe for ProjectionHead
impl Send for ProjectionHead
impl Sync for ProjectionHead
impl Unpin for ProjectionHead
impl UnsafeUnpin for ProjectionHead
impl UnwindSafe for ProjectionHead
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
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