Struct SmoothL1LossConfig
pub struct SmoothL1LossConfig {
pub beta: f32,
}Expand description
Configuration for the SmoothL1Loss module.
Smooth L1 loss combines L1 and L2 loss, using L2 loss for small errors (below beta) and L1 loss for large errors (above beta). This makes it less sensitive to outliers than MSE while maintaining smooth gradients near zero.
§Example
ⓘ
use burn_nn::loss::{SmoothL1LossConfig, Reduction};
// Create Smooth L1 loss with default beta=1.0
let smooth_l1 = SmoothL1LossConfig::new().init();
// Create with custom beta
let smooth_l1_custom = SmoothL1LossConfig::new().with_beta(0.5).init();Fields§
§beta: f32Specifies the threshold at which to change between L1 and L2 loss. The value must be positive. Default: 1.0
Implementations§
§impl SmoothL1LossConfig
impl SmoothL1LossConfig
pub fn new() -> SmoothL1LossConfig
pub fn new() -> SmoothL1LossConfig
§impl SmoothL1LossConfig
impl SmoothL1LossConfig
pub fn with_beta(self, beta: f32) -> SmoothL1LossConfig
pub fn with_beta(self, beta: f32) -> SmoothL1LossConfig
Sets the value for the field beta.
Specifies the threshold at which to change between L1 and L2 loss. The value must be positive. Default: 1.0
- Defaults to
1.0
§impl SmoothL1LossConfig
impl SmoothL1LossConfig
pub fn init(&self) -> SmoothL1Loss
pub fn init(&self) -> SmoothL1Loss
Trait Implementations§
§impl Clone for SmoothL1LossConfig
impl Clone for SmoothL1LossConfig
§fn clone(&self) -> SmoothL1LossConfig
fn clone(&self) -> SmoothL1LossConfig
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 SmoothL1LossConfig
impl Config for SmoothL1LossConfig
§impl Debug for SmoothL1LossConfig
impl Debug for SmoothL1LossConfig
§impl<'de> Deserialize<'de> for SmoothL1LossConfig
impl<'de> Deserialize<'de> for SmoothL1LossConfig
§fn deserialize<D>(
deserializer: D,
) -> Result<SmoothL1LossConfig, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<SmoothL1LossConfig, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Display for SmoothL1LossConfig
impl Display for SmoothL1LossConfig
§impl Serialize for SmoothL1LossConfig
impl Serialize for SmoothL1LossConfig
§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 SmoothL1LossConfig
impl RefUnwindSafe for SmoothL1LossConfig
impl Send for SmoothL1LossConfig
impl Sync for SmoothL1LossConfig
impl Unpin for SmoothL1LossConfig
impl UnwindSafe for SmoothL1LossConfig
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
§impl<C> CloneExpand for Cwhere
C: Clone,
impl<C> CloneExpand for Cwhere
C: Clone,
fn __expand_clone_method(&self, _scope: &mut Scope) -> C
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
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