[][src]Trait neuro::losses::Loss

pub trait Loss {
    fn id(&self) -> u64;
fn eval(&self, y_pred: &Tensor, y_true: &Tensor) -> PrimitiveType;
fn grad(&self, y_pred: &Tensor, y_true: &Tensor) -> Tensor; }

Defines the behaviors of a loss function.

Required methods

fn id(&self) -> u64

Returns a unique identifier.

fn eval(&self, y_pred: &Tensor, y_true: &Tensor) -> PrimitiveType

Computes the value of the loss function from the predicted and true labels.

fn grad(&self, y_pred: &Tensor, y_true: &Tensor) -> Tensor

Computes the gradient of the loss function from the predicted and true labels.

Loading content...

Implementors

impl Loss for BinaryCrossEntropy[src]

impl Loss for CrossEntropy[src]

impl Loss for MeanAbsoluteError[src]

impl Loss for MeanSquaredError[src]

impl Loss for SoftmaxCrossEntropy[src]

Loading content...