pub struct CrossEntropyLoss { /* private fields */ }
Expand description
CrossEntropyLoss
Implementations
sourceimpl CrossEntropyLoss
impl CrossEntropyLoss
pub fn new() -> CrossEntropyLoss
Trait Implementations
sourceimpl Default for CrossEntropyLoss
impl Default for CrossEntropyLoss
sourceimpl<'de> Deserialize<'de> for CrossEntropyLoss
impl<'de> Deserialize<'de> for CrossEntropyLoss
sourcefn 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
sourceimpl OpTrait for CrossEntropyLoss
impl OpTrait for CrossEntropyLoss
sourcefn apply(&self, input: &[Tensor], output: &[Tensor])
fn apply(&self, input: &[Tensor], output: &[Tensor])
The first is the prediction, the second input is the label ORDER IS IMPORTANT, SECOND ARGUMENT WON’T GET GRADEINT.
sourcefn grad(&self, input: &[Tensor], output_grad: &[Tensor], input_grad: &[Tensor])
fn grad(&self, input: &[Tensor], output_grad: &[Tensor], input_grad: &[Tensor])
Given the forward input value and backward output_grad, Update weight gradient. return backward input gradeint.
sourcefn get_values(&self) -> Vec<Tensor>
fn get_values(&self) -> Vec<Tensor>
access weight values
sourcefn get_input_size(&self) -> usize
fn get_input_size(&self) -> usize
The number of input needs by this op.
sourcefn get_output_size(&self) -> usize
fn get_output_size(&self) -> usize
The number of output produced by this op.
fn set_values(&self, _v: &[Tensor])
fn as_any(&self) -> &dyn Any
sourceimpl Serialize for CrossEntropyLoss
impl Serialize for CrossEntropyLoss
Auto Trait Implementations
impl !RefUnwindSafe for CrossEntropyLoss
impl !Send for CrossEntropyLoss
impl !Sync for CrossEntropyLoss
impl Unpin for CrossEntropyLoss
impl !UnwindSafe for CrossEntropyLoss
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more