CppMatrix
Loading...
Searching...
No Matches
functional.cpp File Reference
#include <utility>
import cpp_matrix.neural_network:tensor;
Include dependency graph for functional.cpp:

Functions

template<Backend Matrix>
Tensor< Matrixcpp_matrix::neural_network::functional::MeanSquaredErrorLoss (const Tensor< Matrix > &input, const Tensor< Matrix > &target)
 Measure the element-wise Mean Squared Error.
 
auto cpp_matrix::neural_network::functional::MseLoss (auto &&... args)
 Alias of MeanSquaredErrorLoss().
 
template<Backend Matrix>
Tensor< Matrixcpp_matrix::neural_network::functional::Sigmoid (const Tensor< Matrix > &tensor)
 Applies the element-wise function \( Sigmoid(x) \).
 

Function Documentation

◆ MeanSquaredErrorLoss()

template<Backend Matrix>
Tensor< Matrix > cpp_matrix::neural_network::functional::MeanSquaredErrorLoss ( const Tensor< Matrix > & input,
const Tensor< Matrix > & target )
export

Measure the element-wise Mean Squared Error.

If \( input \) is the matrix of predicted values and \( target \) is the matrix of ground truth values, then:

\[ MSE(input, target) = {1 \over n} \sum_{i=1}^n (input_i - target_i)^2 \]

Parameters
inputPredicted values.
targetGround truth values.
Returns
Mean Squared Error loss, should be a 1x1 Tensor.

◆ Sigmoid()

template<Backend Matrix>
Tensor< Matrix > cpp_matrix::neural_network::functional::Sigmoid ( const Tensor< Matrix > & tensor)
export

Applies the element-wise function \( Sigmoid(x) \).

\( Sigmoid(x) \) is defined as:

\[ Sigmoid(x) = {1 \over 1 + e^{-x}} \]