pub struct Dropout {
pub dropout_rate: f64,
pub is_training: bool,
pub variational: bool,
/* private fields */
}
Expand description
Dropout layer for regularization
Implements different types of dropout:
- Standard dropout: randomly sets elements to zero
- Variational dropout: uses same mask across time steps (for RNNs)
- Zoneout: keeps some hidden/cell state values from previous timestep
Fields§
§dropout_rate: f64
§is_training: bool
§variational: bool
Implementations§
Source§impl Dropout
impl Dropout
pub fn new(dropout_rate: f64) -> Self
pub fn variational(dropout_rate: f64) -> Self
pub fn train(&mut self)
pub fn eval(&mut self)
pub fn forward(&mut self, input: &Array2<f64>) -> Array2<f64>
pub fn get_last_mask(&self) -> Option<&Array2<f64>>
pub fn backward(&self, grad_output: &Array2<f64>) -> Array2<f64>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Dropout
impl RefUnwindSafe for Dropout
impl Send for Dropout
impl Sync for Dropout
impl Unpin for Dropout
impl UnwindSafe for Dropout
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