pub enum MAMLVariant {
SecondOrder,
FirstOrder,
Reptile,
}Expand description
Variant of MAML to use.
The variants share the same inner-loop adaptation procedure but differ in how the outer (meta-) gradient is computed.
Variants§
SecondOrder
Full MAML with a second-order term. Because OptiRS does not maintain a
computation graph, the Hessian-vector product is approximated by a
finite difference of inner gradients along the adaptation trajectory.
This yields a meta-gradient of the form
final_loss_grad - alpha * (g_K - g_0) / K (elementwise) * final_loss_grad,
which captures the leading second-order correction without ever
instantiating the Hessian.
FirstOrder
First-Order MAML (FOMAML): drops the Hessian term entirely. The
meta-gradient is simply final_loss_grad. Cheaper than SecondOrder
and usually competitive in practice.
Reptile
Reptile-style update: the meta-gradient is
(initial_params - adapted_params) / alpha. No second-order math is
required and the resulting direction is empirically similar to FOMAML.
Trait Implementations§
Source§impl Clone for MAMLVariant
impl Clone for MAMLVariant
Source§fn clone(&self) -> MAMLVariant
fn clone(&self) -> MAMLVariant
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MAMLVariant
Source§impl Debug for MAMLVariant
impl Debug for MAMLVariant
Source§impl PartialEq for MAMLVariant
impl PartialEq for MAMLVariant
impl StructuralPartialEq for MAMLVariant
Auto Trait Implementations§
impl Freeze for MAMLVariant
impl RefUnwindSafe for MAMLVariant
impl Send for MAMLVariant
impl Sync for MAMLVariant
impl Unpin for MAMLVariant
impl UnsafeUnpin for MAMLVariant
impl UnwindSafe for MAMLVariant
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
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> ⓘ
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> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.