pub struct Dropout {
pub p: f32,
/* private fields */
}
Expand description
A Moduleself.p
.
This also implements [Module<(Tensor, Rng)>] if you want to pass in an Rng externally, though this may be harder to use and infect other modules.
Default is implemented as p=0.5
and seeds.
Implementation details: This stores the Rng in a RefCell to maintain compatibility with forward taking a non-mutable reference to self.
Example:
type MlpWithDropout = (
Dropout,
Linear<5, 10>,
ReLU,
Dropout,
);
// or
let my_mlp = (
Dropout::p(0.5),
Linear::<5, 10>::default(),
ReLU::default(),
Dropout::p(0.1),
);
Fields
p: f32
Implementations
Trait Implementations
sourceimpl CanUpdateWithGradients for Dropout
impl CanUpdateWithGradients for Dropout
sourcefn update<G: GradientProvider>(&mut self, _: &mut G)
fn update<G: GradientProvider>(&mut self, _: &mut G)
Does nothing.
sourceimpl LoadFromNpz for Dropout
impl LoadFromNpz for Dropout
sourceimpl ResetParams for Dropout
impl ResetParams for Dropout
sourcefn reset_params<R: Rng>(&mut self, _: &mut R)
fn reset_params<R: Rng>(&mut self, _: &mut R)
Does nothing.
Auto Trait Implementations
impl !RefUnwindSafe for Dropout
impl Send for Dropout
impl !Sync for Dropout
impl Unpin for Dropout
impl UnwindSafe for Dropout
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more