pub struct DARTSSearch {
pub n_nodes: usize,
pub n_ops: usize,
pub alpha: Vec<Vec<f64>>,
pub learning_rate: f64,
pub n_input_nodes: usize,
}Expand description
DARTS continuous architecture parameterisation.
alpha[e][k] is the (un-normalised) log-weight for operation k on
edge e. Normalised weights are obtained via softmax.
Fields§
§n_nodes: usizeNumber of intermediate nodes in the cell
n_ops: usizeNumber of candidate operations
alpha: Vec<Vec<f64>>Architecture weights: shape [n_edges, n_ops]
learning_rate: f64Learning rate for architecture weight updates
n_input_nodes: usizeNumber of input nodes (from previous cells)
Implementations§
Source§impl DARTSSearch
impl DARTSSearch
Sourcepub fn new(n_nodes: usize, operations: &[OpType], n_input_nodes: usize) -> Self
pub fn new(n_nodes: usize, operations: &[OpType], n_input_nodes: usize) -> Self
Initialise DARTS with uniform architecture weights.
§Arguments
n_nodes: Number of intermediate nodes per cell.operations: Slice of candidate operations.n_input_nodes: Number of fixed input nodes (e.g., 2 for DARTS).
Sourcepub fn get_op_weights(&self, edge_idx: usize) -> Vec<f64>
pub fn get_op_weights(&self, edge_idx: usize) -> Vec<f64>
Softmax-normalised operation weights for a given edge.
Returns a zero vector if edge_idx is out of range.
Sourcepub fn derive_architecture(
&self,
space: &SearchSpace,
n_cells: usize,
channels: usize,
n_classes: usize,
) -> Architecture
pub fn derive_architecture( &self, space: &SearchSpace, n_cells: usize, channels: usize, n_classes: usize, ) -> Architecture
Derive a discrete architecture by taking argmax(α) per edge.
Returns an Architecture whose edges carry the selected operations.
Sourcepub fn update_alpha(
&mut self,
edge_idx: usize,
op_idx: usize,
grad: f64,
) -> Result<(), OptimizeError>
pub fn update_alpha( &mut self, edge_idx: usize, op_idx: usize, grad: f64, ) -> Result<(), OptimizeError>
Apply an external gradient update to a single (edge, op) weight.
Typical usage: call after computing ∂L/∂α[edge_idx][op_idx]
from a validation loss.
Sourcepub fn update_alpha_batch(
&mut self,
grads: &[Vec<f64>],
) -> Result<(), OptimizeError>
pub fn update_alpha_batch( &mut self, grads: &[Vec<f64>], ) -> Result<(), OptimizeError>
Batch update: apply gradient matrix grads[edge][op] to all weights.
grads must have shape [n_edges, n_ops].
Trait Implementations§
Source§impl Clone for DARTSSearch
impl Clone for DARTSSearch
Source§fn clone(&self) -> DARTSSearch
fn clone(&self) -> DARTSSearch
1.0.0 · 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> 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.