#[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§
Source§impl NormalizationConfig
impl NormalizationConfig
Sourcepub 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.
Sourcepub fn with_num_features(self, num_features: usize) -> NormalizationConfig
pub fn with_num_features(self, num_features: usize) -> NormalizationConfig
Set the number of features.
Sourcepub fn num_features(&self) -> usize
pub fn num_features(&self) -> usize
Get the number of features.
Trait Implementations§
Source§impl Clone for NormalizationConfig
impl Clone for NormalizationConfig
Source§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 moreSource§impl Config for NormalizationConfig
impl Config for NormalizationConfig
Source§fn load<P>(file: P) -> Result<Self, ConfigError>
fn load<P>(file: P) -> Result<Self, ConfigError>
Loads the configuration from a file. Read more
Source§fn load_binary(data: &[u8]) -> Result<Self, ConfigError>
fn load_binary(data: &[u8]) -> Result<Self, ConfigError>
Loads the configuration from a binary buffer. Read more
Source§impl Debug for NormalizationConfig
impl Debug for NormalizationConfig
Source§impl<'de> Deserialize<'de> for NormalizationConfig
impl<'de> Deserialize<'de> for NormalizationConfig
Source§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
Source§impl Display for NormalizationConfig
impl Display for NormalizationConfig
Source§impl From<BatchNormConfig> for NormalizationConfig
impl From<BatchNormConfig> for NormalizationConfig
Source§fn from(config: BatchNormConfig) -> NormalizationConfig
fn from(config: BatchNormConfig) -> NormalizationConfig
Converts to this type from the input type.
Source§impl From<GroupNormConfig> for NormalizationConfig
impl From<GroupNormConfig> for NormalizationConfig
Source§fn from(config: GroupNormConfig) -> NormalizationConfig
fn from(config: GroupNormConfig) -> NormalizationConfig
Converts to this type from the input type.
Source§impl From<InstanceNormConfig> for NormalizationConfig
impl From<InstanceNormConfig> for NormalizationConfig
Source§fn from(config: InstanceNormConfig) -> NormalizationConfig
fn from(config: InstanceNormConfig) -> NormalizationConfig
Converts to this type from the input type.
Source§impl From<LayerNormConfig> for NormalizationConfig
impl From<LayerNormConfig> for NormalizationConfig
Source§fn from(config: LayerNormConfig) -> NormalizationConfig
fn from(config: LayerNormConfig) -> NormalizationConfig
Converts to this type from the input type.
Source§impl From<RmsNormConfig> for NormalizationConfig
impl From<RmsNormConfig> for NormalizationConfig
Source§fn from(config: RmsNormConfig) -> NormalizationConfig
fn from(config: RmsNormConfig) -> NormalizationConfig
Converts to this type from the input type.
Source§impl Serialize for NormalizationConfig
impl Serialize for NormalizationConfig
Source§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