Apache Singa
A General Distributed Deep Learning Library
Public Member Functions | List of all members
singa::MSE Class Reference

MSE is for mean squared error or squared euclidean distance. More...

#include <loss.h>

Inheritance diagram for singa::MSE:
Inheritance graph
[legend]
Collaboration diagram for singa::MSE:
Collaboration graph
[legend]

Public Member Functions

Tensor Forward (int flag, const Tensor &prediction, const Tensor &target) override
 Compute the loss values for each sample/instance given the prediction and the target, which is 0.5/||prediction-target||^2 Users can call Average(const Tensor&) to get the average loss value over all samples in the batch. More...
 
Tensor Backward () override
 Compute the gradients of the loss values w.r.t. More...
 
- Public Member Functions inherited from singa::Loss
void Setup (const string &conf)
 
virtual void ToDevice (std::shared_ptr< Device > device)
 
virtual void Setup (const LossConf &conf)
 Set meta fields from user configurations.
 
float Evaluate (int flag, const Tensor &prediction, const Tensor &target)
 Average loss values for all samples in the mini-batch It calls Forward() internally. More...
 

Detailed Description

MSE is for mean squared error or squared euclidean distance.

Member Function Documentation

◆ Backward()

Tensor singa::MSE::Backward ( )
overridevirtual

Compute the gradients of the loss values w.r.t.

the prediction, which is (prediction-target)/batchsize

Implements singa::Loss.

◆ Forward()

Tensor singa::MSE::Forward ( int  flag,
const Tensor prediction,
const Tensor target 
)
overridevirtual

Compute the loss values for each sample/instance given the prediction and the target, which is 0.5/||prediction-target||^2 Users can call Average(const Tensor&) to get the average loss value over all samples in the batch.

Implements singa::Loss.


The documentation for this class was generated from the following file: