pub struct Sequential {
pub layers: Vec<Layer>,
}Expand description
Sequential model: chains layers in order.
Fields§
§layers: Vec<Layer>Layers executed in order.
Implementations§
Source§impl Sequential
impl Sequential
Sourcepub fn add_linear(self, in_f: usize, out_f: usize) -> Self
pub fn add_linear(self, in_f: usize, out_f: usize) -> Self
Append a Linear layer.
Sourcepub fn add_layer_norm(self, normalized_shape: usize) -> Self
pub fn add_layer_norm(self, normalized_shape: usize) -> Self
Append a LayerNorm layer.
Sourcepub fn add_dropout(self, p: f64) -> Self
pub fn add_dropout(self, p: f64) -> Self
Append a Dropout layer.
Sourcepub fn add_activation(self, act: Activation) -> Self
pub fn add_activation(self, act: Activation) -> Self
Append an activation.
Sourcepub fn forward(&mut self, x: &Tensor, training: bool) -> MathResult<Tensor>
pub fn forward(&mut self, x: &Tensor, training: bool) -> MathResult<Tensor>
Forward pass through all layers.
Sourcepub fn num_params(&self) -> usize
pub fn num_params(&self) -> usize
Total number of parameters.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sequential
impl RefUnwindSafe for Sequential
impl Send for Sequential
impl Sync for Sequential
impl Unpin for Sequential
impl UnsafeUnpin for Sequential
impl UnwindSafe for Sequential
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