pub struct FeedForwardNet {
pub layers: Vec<DenseLayer>,
}Expand description
A sequential feed-forward neural network.
Fields§
§layers: Vec<DenseLayer>Ordered list of dense layers.
Implementations§
Source§impl FeedForwardNet
impl FeedForwardNet
Sourcepub fn add_layer(&mut self, layer: DenseLayer)
pub fn add_layer(&mut self, layer: DenseLayer)
Append a layer to the end of the network.
Sourcepub fn input_size(&self) -> Option<usize>
pub fn input_size(&self) -> Option<usize>
Returns the expected input width (None if the network has no layers).
Sourcepub fn output_size(&self) -> Option<usize>
pub fn output_size(&self) -> Option<usize>
Returns the output width of the last layer (None if empty).
Sourcepub fn total_parameters(&self) -> usize
pub fn total_parameters(&self) -> usize
Sum of parameters across all layers.
Source§impl FeedForwardNet
impl FeedForwardNet
Sourcepub fn compute_gradient_norm(&self, layer_grads: &[Vec<f32>]) -> f32
pub fn compute_gradient_norm(&self, layer_grads: &[Vec<f32>]) -> f32
Compute the total gradient norm across all layers.
layer_grads[i] is the concatenated [grad_weights, grad_biases] for
layer i. Returns the L2 norm of all gradients combined.
Trait Implementations§
Source§impl Clone for FeedForwardNet
impl Clone for FeedForwardNet
Source§fn clone(&self) -> FeedForwardNet
fn clone(&self) -> FeedForwardNet
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FeedForwardNet
impl Debug for FeedForwardNet
Auto Trait Implementations§
impl Freeze for FeedForwardNet
impl RefUnwindSafe for FeedForwardNet
impl Send for FeedForwardNet
impl Sync for FeedForwardNet
impl Unpin for FeedForwardNet
impl UnsafeUnpin for FeedForwardNet
impl UnwindSafe for FeedForwardNet
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
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>
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