pub struct BYOL { /* private fields */ }Expand description
BYOL (Bootstrap Your Own Latent) framework (Grill et al., 2020).
Self-supervised learning WITHOUT negative samples:
- Online network predicts target network representation
- Target network is momentum-updated from online
- Stops gradient on target to prevent collapse
§Reference
Grill, J.B., et al. (2020). Bootstrap Your Own Latent: A New Approach to Self-Supervised Learning. NeurIPS.
Implementations§
Source§impl BYOL
impl BYOL
Sourcepub fn loss(&self, online_pred: &[Vec<f32>], target_proj: &[Vec<f32>]) -> f32
pub fn loss(&self, online_pred: &[Vec<f32>], target_proj: &[Vec<f32>]) -> f32
Compute BYOL loss (MSE between normalized predictions).
§Arguments
online_pred- Predictions from online networktarget_proj- Projections from target network (stop gradient)
Sourcepub fn symmetric_loss(
&self,
pred_1: &[Vec<f32>],
proj_2: &[Vec<f32>],
pred_2: &[Vec<f32>],
proj_1: &[Vec<f32>],
) -> f32
pub fn symmetric_loss( &self, pred_1: &[Vec<f32>], proj_2: &[Vec<f32>], pred_2: &[Vec<f32>], proj_1: &[Vec<f32>], ) -> f32
Symmetric BYOL loss (both views predict each other).
Sourcepub fn momentum_update(&self, online_params: &[f32], target_params: &mut [f32])
pub fn momentum_update(&self, online_params: &[f32], target_params: &mut [f32])
Update target network parameters with momentum.
pub fn momentum(&self) -> f32
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BYOL
impl RefUnwindSafe for BYOL
impl Send for BYOL
impl Sync for BYOL
impl Unpin for BYOL
impl UnwindSafe for BYOL
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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