pub struct ParamGroup { /* private fields */ }Expand description
A way to represent a group of parameter for a Burn module.
Implementations§
Source§impl ParamGroup
impl ParamGroup
Sourcepub fn matches(&self, id: &ParamId, path: Option<&str>) -> bool
pub fn matches(&self, id: &ParamId, path: Option<&str>) -> bool
Evaluates whether a given parameter ID and its module path match this group.
Sourcepub fn ids_from_module<M: Module>(module: M) -> Self
pub fn ids_from_module<M: Module>(module: M) -> Self
Returns a parameter group with all of the module’s parameters.
Sourcepub fn from_path(path: impl Into<String>) -> Self
pub fn from_path(path: impl Into<String>) -> Self
Matches parameters by exact text path (e.g., “model.backbone.linear.weight”)
Sourcepub fn from_paths(paths: Vec<impl Into<String>>) -> Self
pub fn from_paths(paths: Vec<impl Into<String>>) -> Self
Matches parameters by exact text paths (e.g., “model.backbone.linear.weight”, etc.)
Sourcepub fn from_predicate(path: impl Into<String>) -> Self
pub fn from_predicate(path: impl Into<String>) -> Self
Matches parameters that include the predicate in their paths (e.g., “backbone”)
Sourcepub fn from_predicates(paths: Vec<impl Into<String>>) -> Self
pub fn from_predicates(paths: Vec<impl Into<String>>) -> Self
Matches parameters that include all the predicates in their path (AND logic). (e.g., parameter path contains “backbone” and “linear”)
Sourcepub fn from_any_predicates(paths: Vec<impl Into<String>>) -> Self
pub fn from_any_predicates(paths: Vec<impl Into<String>>) -> Self
Matches parameters that include any of the predicates in their path (OR logic). (e.g., parameter path contains “backbone” or “linear”)
Sourcepub fn from_regex<S: AsRef<str>>(pattern: S) -> Result<Self, ParamGroupError>
Available on crate feature std only.
pub fn from_regex<S: AsRef<str>>(pattern: S) -> Result<Self, ParamGroupError>
std only.Matches parameters by regex pattern (e.g., “^model.layer.\d+$”)
§Errors
Returns a ParamGroupError::InvalidPatternError if the string cannot be compiled into a valid regex.
Sourcepub fn from_regexes<S: AsRef<str>>(
patterns: Vec<S>,
) -> Result<Self, ParamGroupError>
Available on crate feature std only.
pub fn from_regexes<S: AsRef<str>>( patterns: Vec<S>, ) -> Result<Self, ParamGroupError>
std only.Matches parameters for all the regex patterns (AND logic). (e.g., “^encoder.layer.\d+”, and “bias$” )
§Errors
Returns a ParamGroupError::InvalidPatternError if the strings cannot be compiled into a valid regex.
Sourcepub fn from_any_regexes<S: AsRef<str>>(
patterns: Vec<S>,
) -> Result<Self, ParamGroupError>
Available on crate feature std only.
pub fn from_any_regexes<S: AsRef<str>>( patterns: Vec<S>, ) -> Result<Self, ParamGroupError>
std only.Matches parameters for any the regex patterns (OR logic). (e.g., “^encoder.layer.\d+$”, or “^decoder.layer.\d+$” )
§Errors
Returns a ParamGroupError::InvalidPatternError if the strings cannot be compiled into a valid regex.
Trait Implementations§
Source§impl Clone for ParamGroup
impl Clone for ParamGroup
Source§fn clone(&self) -> ParamGroup
fn clone(&self) -> ParamGroup
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParamGroup
impl Debug for ParamGroup
Source§impl<'de> Deserialize<'de> for ParamGroup
impl<'de> Deserialize<'de> for ParamGroup
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ParamGroup
impl RefUnwindSafe for ParamGroup
impl Send for ParamGroup
impl Sync for ParamGroup
impl Unpin for ParamGroup
impl UnsafeUnpin for ParamGroup
impl UnwindSafe for ParamGroup
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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