pub struct Dense<V, A, const IN: usize, const OUT: usize> { /* private fields */ }Expand description
A fully connected layer: IN inputs (plus a bias) to OUT neurons with
activation A, and the training state of every connection.
A layer is a building block for NeuralNetwork; on its own it only
exposes its weights.
Implementations§
Source§impl<V: Copy, A, const IN: usize, const OUT: usize> Dense<V, A, IN, OUT>
impl<V: Copy, A, const IN: usize, const OUT: usize> Dense<V, A, IN, OUT>
Sourcepub fn bias_weights(&self) -> [V; OUT]
pub fn bias_weights(&self) -> [V; OUT]
The bias weights: bias_weights()[neuron].
Sourcepub fn set_weights(&mut self, weights: &[[V; OUT]; IN])
pub fn set_weights(&mut self, weights: &[[V; OUT]; IN])
Replace the weights, laid out as weights returns
them. The training state (delta weights, gradients) is kept.
Sourcepub fn set_bias_weights(&mut self, weights: &[V; OUT])
pub fn set_bias_weights(&mut self, weights: &[V; OUT])
Replace the bias weights.
Source§impl<V: Copy, A, const IN: usize, const OUT: usize> Dense<V, A, IN, OUT>
impl<V: Copy, A, const IN: usize, const OUT: usize> Dense<V, A, IN, OUT>
Sourcepub fn to_inference(&self) -> InferenceDense<V, A, IN, OUT>
pub fn to_inference(&self) -> InferenceDense<V, A, IN, OUT>
This layer’s weights as an InferenceDense.
Sourcepub fn set_from(&mut self, from: &InferenceDense<V, A, IN, OUT>)
pub fn set_from(&mut self, from: &InferenceDense<V, A, IN, OUT>)
Load the weights of an InferenceDense of the same shape (the
training state is left as it is).
Trait Implementations§
Auto Trait Implementations§
impl<V, A, const IN: usize, const OUT: usize> Freeze for Dense<V, A, IN, OUT>where
V: Freeze,
impl<V, A, const IN: usize, const OUT: usize> RefUnwindSafe for Dense<V, A, IN, OUT>where
V: RefUnwindSafe,
impl<V, A, const IN: usize, const OUT: usize> Send for Dense<V, A, IN, OUT>where
V: Send,
impl<V, A, const IN: usize, const OUT: usize> Sync for Dense<V, A, IN, OUT>where
V: Sync,
impl<V, A, const IN: usize, const OUT: usize> Unpin for Dense<V, A, IN, OUT>where
V: Unpin,
impl<V, A, const IN: usize, const OUT: usize> UnsafeUnpin for Dense<V, A, IN, OUT>where
V: UnsafeUnpin,
impl<V, A, const IN: usize, const OUT: usize> UnwindSafe for Dense<V, A, IN, OUT>where
V: UnwindSafe,
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