Enum burn::nn::Initializer
pub enum Initializer {
Constant {
value: f64,
},
Ones,
Zeros,
Uniform {
min: f64,
max: f64,
},
Normal {
mean: f64,
std: f64,
},
KaimingUniform {
gain: f64,
fan_out_only: bool,
},
KaimingNormal {
gain: f64,
fan_out_only: bool,
},
XavierUniform {
gain: f64,
},
XavierNormal {
gain: f64,
},
}
Expand description
Enum specifying with what values a tensor should be initialized
Variants§
Constant
Fills tensor with specified value everywhere
Ones
Fills tensor with 1s everywhere
Zeros
Fills tensor with 0s everywhere
Uniform
Fills tensor with values drawn uniformly between specified values
Normal
Fills tensor with values drawn from normal distribution with specified mean and std
Fields
KaimingUniform
Fills tensor with values according to the uniform version of Kaiming initialization
Fields
KaimingNormal
Fills tensor with values according to the uniform version of Kaiming initialization
Fields
XavierUniform
Fills tensor with values according to the uniform version of Xavier Glorot initialization described in Understanding the difficulty of training deep feedforward neural networks
XavierNormal
Fills tensor with values according to the normal version of Xavier Glorot initialization described in Understanding the difficulty of training deep feedforward neural networks
Implementations§
§impl Initializer
impl Initializer
pub fn init<B, const D: usize, S>(
&self,
shape: S,
device: &<B as Backend>::Device,
) -> Param<Tensor<B, D>>
pub fn init<B, const D: usize, S>( &self, shape: S, device: &<B as Backend>::Device, ) -> Param<Tensor<B, D>>
Inits a tensor parameter of given shape with values depending on initializer kind.
§Params
- shape: Shape of the initiated tensor.
Trait Implementations§
§impl Clone for Initializer
impl Clone for Initializer
§fn clone(&self) -> Initializer
fn clone(&self) -> Initializer
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Config for Initializer
impl Config for Initializer
§impl Debug for Initializer
impl Debug for Initializer
§impl<'de> Deserialize<'de> for Initializer
impl<'de> Deserialize<'de> for Initializer
§fn deserialize<D>(
deserializer: D,
) -> Result<Initializer, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Initializer, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl Display for Initializer
impl Display for Initializer
§impl PartialEq for Initializer
impl PartialEq for Initializer
§impl Serialize for Initializer
impl Serialize for Initializer
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl StructuralPartialEq for Initializer
Auto Trait Implementations§
impl Freeze for Initializer
impl RefUnwindSafe for Initializer
impl Send for Initializer
impl Sync for Initializer
impl Unpin for Initializer
impl UnwindSafe for Initializer
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string()
] Read more§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString
]. Read more