#include <utility>
import cpp_matrix.neural_network:tensor;
◆ 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
-
input | Predicted values. |
target | Ground 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}}
\]