Enum NormalizationConfig
#[non_exhaustive]pub enum NormalizationConfig {
Batch(BatchNormConfig),
Group(GroupNormConfig),
Instance(InstanceNormConfig),
Layer(LayerNormConfig),
Rms(RmsNormConfig),
}Expand description
[‘Normalization’] Configuration.
The enum is non-exhaustive to prepare for future additions.
Can be used as a generic configuration for normalization layers:
- Construct a config with arbitrary input features (we suggest
0). - Clone and match that config to the target input layer,
using the
NormalizationConfig::with_num_features()method.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Batch(BatchNormConfig)
[‘BatchNorm’] Configuration.
Group(GroupNormConfig)
[‘GroupNorm’] Configuration.
Instance(InstanceNormConfig)
[‘InstanceNorm’] Configuration.
Layer(LayerNormConfig)
[‘LayerNorm’] Configuration.
Rms(RmsNormConfig)
[‘RmsNorm’] Configuration.
Implementations§
§impl NormalizationConfig
impl NormalizationConfig
pub fn init<B>(&self, device: &<B as Backend>::Device) -> Normalization<B>where
B: Backend,
pub fn init<B>(&self, device: &<B as Backend>::Device) -> Normalization<B>where
B: Backend,
Initialize a [‘Norm’] layer.
pub fn with_num_features(self, num_features: usize) -> NormalizationConfig
pub fn with_num_features(self, num_features: usize) -> NormalizationConfig
Set the number of features.
pub fn num_features(&self) -> usize
pub fn num_features(&self) -> usize
Get the number of features.
Trait Implementations§
§impl Clone for NormalizationConfig
impl Clone for NormalizationConfig
§fn clone(&self) -> NormalizationConfig
fn clone(&self) -> NormalizationConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Config for NormalizationConfig
impl Config for NormalizationConfig
§impl Debug for NormalizationConfig
impl Debug for NormalizationConfig
§impl<'de> Deserialize<'de> for NormalizationConfig
impl<'de> Deserialize<'de> for NormalizationConfig
§fn deserialize<D>(
deserializer: D,
) -> Result<NormalizationConfig, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<NormalizationConfig, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Display for NormalizationConfig
impl Display for NormalizationConfig
§impl From<BatchNormConfig> for NormalizationConfig
impl From<BatchNormConfig> for NormalizationConfig
§fn from(config: BatchNormConfig) -> NormalizationConfig
fn from(config: BatchNormConfig) -> NormalizationConfig
Converts to this type from the input type.
§impl From<GroupNormConfig> for NormalizationConfig
impl From<GroupNormConfig> for NormalizationConfig
§fn from(config: GroupNormConfig) -> NormalizationConfig
fn from(config: GroupNormConfig) -> NormalizationConfig
Converts to this type from the input type.
§impl From<InstanceNormConfig> for NormalizationConfig
impl From<InstanceNormConfig> for NormalizationConfig
§fn from(config: InstanceNormConfig) -> NormalizationConfig
fn from(config: InstanceNormConfig) -> NormalizationConfig
Converts to this type from the input type.
§impl From<LayerNormConfig> for NormalizationConfig
impl From<LayerNormConfig> for NormalizationConfig
§fn from(config: LayerNormConfig) -> NormalizationConfig
fn from(config: LayerNormConfig) -> NormalizationConfig
Converts to this type from the input type.
§impl From<RmsNormConfig> for NormalizationConfig
impl From<RmsNormConfig> for NormalizationConfig
§fn from(config: RmsNormConfig) -> NormalizationConfig
fn from(config: RmsNormConfig) -> NormalizationConfig
Converts to this type from the input type.
§impl Serialize for NormalizationConfig
impl Serialize for NormalizationConfig
§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,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for NormalizationConfig
impl RefUnwindSafe for NormalizationConfig
impl Send for NormalizationConfig
impl Sync for NormalizationConfig
impl Unpin for NormalizationConfig
impl UnwindSafe for NormalizationConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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>
Fallible version of [
ToCompactString::to_compact_string()] Read more§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a [
CompactString]. Read more