Struct ParamGroup
pub struct ParamGroup { /* private fields */ }Expand description
A way to represent a group of parameter for a Burn module.
Implementations§
§impl ParamGroup
impl ParamGroup
pub 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.
pub fn ids_from_module<M>(module: M) -> ParamGroupwhere
M: Module,
pub fn ids_from_module<M>(module: M) -> ParamGroupwhere
M: Module,
Returns a parameter group with all of the module’s parameters.
pub fn from_path(path: impl Into<String>) -> ParamGroup
pub fn from_path(path: impl Into<String>) -> ParamGroup
Matches parameters by exact text path (e.g., “model.backbone.linear.weight”)
pub fn from_paths(paths: Vec<impl Into<String>>) -> ParamGroup
pub fn from_paths(paths: Vec<impl Into<String>>) -> ParamGroup
Matches parameters by exact text paths (e.g., “model.backbone.linear.weight”, etc.)
pub fn from_predicate(path: impl Into<String>) -> ParamGroup
pub fn from_predicate(path: impl Into<String>) -> ParamGroup
Matches parameters that include the predicate in their paths (e.g., “backbone”)
pub fn from_predicates(paths: Vec<impl Into<String>>) -> ParamGroup
pub fn from_predicates(paths: Vec<impl Into<String>>) -> ParamGroup
Matches parameters that include all the predicates in their path (AND logic). (e.g., parameter path contains “backbone” and “linear”)
pub fn from_any_predicates(paths: Vec<impl Into<String>>) -> ParamGroup
pub fn from_any_predicates(paths: Vec<impl Into<String>>) -> ParamGroup
Matches parameters that include any of the predicates in their path (OR logic). (e.g., parameter path contains “backbone” or “linear”)
pub fn from_regex<S>(pattern: S) -> Result<ParamGroup, ParamGroupError>
pub fn from_regex<S>(pattern: S) -> Result<ParamGroup, ParamGroupError>
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.
pub fn from_regexes<S>(patterns: Vec<S>) -> Result<ParamGroup, ParamGroupError>
pub fn from_regexes<S>(patterns: Vec<S>) -> Result<ParamGroup, ParamGroupError>
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.
pub fn from_any_regexes<S>(
patterns: Vec<S>,
) -> Result<ParamGroup, ParamGroupError>
pub fn from_any_regexes<S>( patterns: Vec<S>, ) -> Result<ParamGroup, ParamGroupError>
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.
pub fn all() -> ParamGroup
pub fn all() -> ParamGroup
Matches any parameter.
pub fn from_ids(ids: Vec<ParamId>) -> ParamGroup
pub fn from_ids(ids: Vec<ParamId>) -> ParamGroup
Matches a specific slice of predefined parameter IDs.
pub fn fuse(self, other: &ParamGroup) -> ParamGroup
pub fn fuse(self, other: &ParamGroup) -> ParamGroup
Fuse two parameter group.
pub fn exclude(self, group: ParamGroup) -> ParamGroup
pub fn exclude(self, group: ParamGroup) -> ParamGroup
Exclude the given group from the current group
Trait Implementations§
§impl Clone for ParamGroup
impl Clone for ParamGroup
§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 more§impl Debug for ParamGroup
impl Debug for ParamGroup
§impl<'de> Deserialize<'de> for ParamGroup
impl<'de> Deserialize<'de> for ParamGroup
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ParamGroup, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ParamGroup, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Serialize for ParamGroup
impl Serialize for ParamGroup
§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,
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<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
§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