pub struct DartsSearch {
pub cells: Vec<DartsCell>,
pub config: DartsConfig,
/* private fields */
}Expand description
Top-level DARTS search controller.
Manages a stack of DartsCells and implements the bi-level optimisation loop.
Fields§
§cells: Vec<DartsCell>Stack of cells forming the super-network.
config: DartsConfigConfiguration.
Implementations§
Source§impl DartsSearch
impl DartsSearch
Sourcepub fn new(config: DartsConfig) -> Self
pub fn new(config: DartsConfig) -> Self
Construct a DartsSearch from the given config.
Sourcepub fn arch_parameters(&self) -> Vec<f64>
pub fn arch_parameters(&self) -> Vec<f64>
Return all architecture parameters across all cells, flattened.
Sourcepub fn n_arch_params(&self) -> usize
pub fn n_arch_params(&self) -> usize
Total number of architecture parameters.
Sourcepub fn update_arch_params(
&mut self,
grads: &[f64],
lr: f64,
) -> OptimizeResult<()>
pub fn update_arch_params( &mut self, grads: &[f64], lr: f64, ) -> OptimizeResult<()>
Apply a gradient step to architecture parameters.
grads must be the same length as arch_parameters().
Sourcepub fn derive_discrete_arch_indices(&self) -> Vec<Vec<Vec<usize>>>
pub fn derive_discrete_arch_indices(&self) -> Vec<Vec<Vec<usize>>>
Derive the discrete architecture: for each cell, argmax op per edge.
Returns Vec<Vec<Vec<usize>>> — [cell][intermediate_node][predecessor].
Sourcepub fn derive_discrete_arch(&self) -> Vec<Vec<Operation>>
pub fn derive_discrete_arch(&self) -> Vec<Vec<Operation>>
Derive the discrete architecture as a vec of Operation vectors.
Uses Operation::all() to map operation index to Operation. If
n_operations exceeds the canonical list length, Operation::Identity
is used as a fallback.
Sourcepub fn bilevel_step(
&mut self,
train_x: &[Vec<f64>],
train_y: &[f64],
val_x: &[Vec<f64>],
val_y: &[f64],
) -> (f64, f64)
pub fn bilevel_step( &mut self, train_x: &[Vec<f64>], train_y: &[f64], val_x: &[Vec<f64>], val_y: &[f64], ) -> (f64, f64)
One bilevel optimisation step (approximate first-order DARTS).
Inner step: update network weights on train_x/train_y.
Outer step: update architecture params on val_x/val_y.
Returns (train_loss, val_loss) before the update.
Trait Implementations§
Source§impl Clone for DartsSearch
impl Clone for DartsSearch
Source§fn clone(&self) -> DartsSearch
fn clone(&self) -> DartsSearch
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DartsSearch
impl RefUnwindSafe for DartsSearch
impl Send for DartsSearch
impl Sync for DartsSearch
impl Unpin for DartsSearch
impl UnsafeUnpin for DartsSearch
impl UnwindSafe for DartsSearch
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
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
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.