pub struct CrossEntropy<'a> {
pub weights: Option<&'a Array>,
pub axis: i32,
pub label_smoothing: f32,
pub reduction: LossReduction,
}
Expand description
Cross entropy loss function.
Fields§
§weights: Option<&'a Array>
Weights for each target
axis: i32
The axis over which to compute softmax. Default to CrossEntropy::DEFAULT_AXIS
label_smoothing: f32
The label smoothing factor, range [0, 1). Default to
CrossEntropy::DEFAULT_LABEL_SMOOTHING
reduction: LossReduction
Reduction type. Default to CrossEntropy::DEFAULT_REDUCTION
Implementations§
Source§impl<'a> CrossEntropy<'a>
impl<'a> CrossEntropy<'a>
Source§impl<'a> CrossEntropy<'a>
impl<'a> CrossEntropy<'a>
Sourcepub const DEFAULT_AXIS: i32 = -1i32
pub const DEFAULT_AXIS: i32 = -1i32
Default value for the axis
parameter.
Sourcepub const DEFAULT_LABEL_SMOOTHING: f32 = 0f32
pub const DEFAULT_LABEL_SMOOTHING: f32 = 0f32
Default value for the label_smoothing
parameter.
Sourcepub const DEFAULT_REDUCTION: LossReduction = LossReduction::None
pub const DEFAULT_REDUCTION: LossReduction = LossReduction::None
Default value for the reduction
parameter.
Sourcepub const DEFAULT_WEIGHTS: Option<&'a Array> = None
pub const DEFAULT_WEIGHTS: Option<&'a Array> = None
Default value for the weights
parameter.
Trait Implementations§
Source§impl<'a> Buildable for CrossEntropy<'a>
impl<'a> Buildable for CrossEntropy<'a>
Source§type Builder = CrossEntropyBuilder<'a>
type Builder = CrossEntropyBuilder<'a>
The builder type for this buildable type
Source§impl<'a> Builder<CrossEntropy<'a>> for CrossEntropyBuilder<'a>
impl<'a> Builder<CrossEntropy<'a>> for CrossEntropyBuilder<'a>
Source§type Error = CrossEntropyBuildError
type Error = CrossEntropyBuildError
Error with building
Source§impl<'a> Clone for CrossEntropy<'a>
impl<'a> Clone for CrossEntropy<'a>
Source§fn clone(&self) -> CrossEntropy<'a>
fn clone(&self) -> CrossEntropy<'a>
Returns a copy 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 moreAuto Trait Implementations§
impl<'a> Freeze for CrossEntropy<'a>
impl<'a> RefUnwindSafe for CrossEntropy<'a>
impl<'a> !Send for CrossEntropy<'a>
impl<'a> !Sync for CrossEntropy<'a>
impl<'a> Unpin for CrossEntropy<'a>
impl<'a> UnwindSafe for CrossEntropy<'a>
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 moreSource§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Convert into an
Option
.