pub struct ModuleConfig {
pub training: bool,
pub device: DeviceType,
pub bias: bool,
pub dropout: f32,
pub custom: HashMap<String, String>,
}Expand description
Generic module configuration
This provides a standard configuration interface that can be extended by specific module types.
Fields§
§training: boolTraining mode
device: DeviceTypeTarget device
bias: boolWhether to use bias terms
dropout: f32Dropout probability
custom: HashMap<String, String>Custom parameters (placeholder when serialize feature is disabled)
Implementations§
Source§impl ModuleConfig
impl ModuleConfig
Sourcepub fn device(self, device: DeviceType) -> Self
pub fn device(self, device: DeviceType) -> Self
Set device
Sourcepub fn custom_param<T: Display>(self, name: &str, value: T) -> Self
pub fn custom_param<T: Display>(self, name: &str, value: T) -> Self
Add a custom parameter (simplified version when serialize feature is disabled)
Sourcepub fn get_custom(&self, name: &str) -> Option<String>
pub fn get_custom(&self, name: &str) -> Option<String>
Get a custom parameter (simplified version when serialize feature is disabled)
Trait Implementations§
Source§impl Clone for ModuleConfig
impl Clone for ModuleConfig
Source§fn clone(&self) -> ModuleConfig
fn clone(&self) -> ModuleConfig
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 Debug for ModuleConfig
impl Debug for ModuleConfig
Auto Trait Implementations§
impl Freeze for ModuleConfig
impl RefUnwindSafe for ModuleConfig
impl Send for ModuleConfig
impl Sync for ModuleConfig
impl Unpin for ModuleConfig
impl UnsafeUnpin for ModuleConfig
impl UnwindSafe for ModuleConfig
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