Struct burn_core::nn::loss::BinaryCrossEntropyLossConfig
source · pub struct BinaryCrossEntropyLossConfig {
pub weights: Option<[f32; 2]>,
/* private fields */
}Expand description
Configuration to create a Binary Cross-entropy loss.
Fields§
§weights: Option<[f32; 2]>Create weighted binary cross-entropy.
The loss of a specific sample will simply be given by: weight * log(p(x)) * 1,
Pre-conditions
- The order of the weight vector should correspond to the label integer assignment.
- Targets assigned negative Int’s will not be allowed.
Implementations§
source§impl BinaryCrossEntropyLossConfig
impl BinaryCrossEntropyLossConfig
sourcepub fn with_logits(self, logits: bool) -> Self
pub fn with_logits(self, logits: bool) -> Self
Create binary cross-entropy with probabilities as input instead of logits.
sourcepub fn with_weights(self, weights: Option<[f32; 2]>) -> Self
pub fn with_weights(self, weights: Option<[f32; 2]>) -> Self
Set the default value for the field.
sourcepub fn with_smoothing(self, smoothing: Option<f32>) -> Self
pub fn with_smoothing(self, smoothing: Option<f32>) -> Self
Set the default value for the field.
source§impl BinaryCrossEntropyLossConfig
impl BinaryCrossEntropyLossConfig
sourcepub fn init<B: Backend>(&self) -> BinaryCrossEntropyLoss<B>
pub fn init<B: Backend>(&self) -> BinaryCrossEntropyLoss<B>
Initialize Binary Cross-entropy loss.
Trait Implementations§
source§impl Clone for BinaryCrossEntropyLossConfig
impl Clone for BinaryCrossEntropyLossConfig
source§impl Config for BinaryCrossEntropyLossConfig
impl Config for BinaryCrossEntropyLossConfig
source§fn save<P: AsRef<Path>>(&self, file: P) -> Result<()>
fn save<P: AsRef<Path>>(&self, file: P) -> Result<()>
Saves the configuration to a file. Read more
source§fn load<P: AsRef<Path>>(file: P) -> Result<Self, ConfigError>
fn load<P: AsRef<Path>>(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 BinaryCrossEntropyLossConfig
impl Debug for BinaryCrossEntropyLossConfig
source§impl<'de> Deserialize<'de> for BinaryCrossEntropyLossConfig
impl<'de> Deserialize<'de> for BinaryCrossEntropyLossConfig
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl RefUnwindSafe for BinaryCrossEntropyLossConfig
impl Send for BinaryCrossEntropyLossConfig
impl Sync for BinaryCrossEntropyLossConfig
impl Unpin for BinaryCrossEntropyLossConfig
impl UnwindSafe for BinaryCrossEntropyLossConfig
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