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, _: &mut UnusedTensors)
fn update<G: GradientProvider>(&mut self, _: &mut G, _: &mut UnusedTensors)
Does nothing.
sourceimpl LoadFromNpz for Dropout
impl LoadFromNpz for Dropout
sourceimpl<R: Rng + SeedableRng, T: Tensor<Dtype = f32>> Module<(T, R)> for Dropout
impl<R: Rng + SeedableRng, T: Tensor<Dtype = f32>> Module<(T, R)> for Dropout
sourcefn forward_mut(&mut self, input: Input) -> Self::Output
fn forward_mut(&mut self, input: Input) -> Self::Output
Pass an Input
through the unit and produce Self::Output.
Can be implemented for multiple Input
types. Read more
sourceimpl<T: Tensor<Dtype = f32>> Module<T> for Dropout
impl<T: Tensor<Dtype = f32>> Module<T> for Dropout
type Output = T
type Output = T
The type that this unit produces given Input
.
sourcefn forward_mut(&mut self, input: Input) -> Self::Output
fn forward_mut(&mut self, input: Input) -> Self::Output
Pass an Input
through the unit and produce Self::Output.
Can be implemented for multiple Input
types. Read more
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