Deep Learning Algorithm Implementations 1.0.0
C++ implementations of fundamental deep learning algorithms
|
Binary Cross Entropy Loss with autograd support. More...
#include <losses.hpp>
Public Member Functions | |
BCELoss (const std::string &reduction="mean") | |
Constructor. | |
Variable< T > | forward (const Variable< T > &predictions, const Variable< T > &targets) override |
Forward pass: compute binary cross entropy loss. | |
![]() | |
virtual | ~AutogradLoss ()=default |
Variable< T > | operator() (const Variable< T > &predictions, const Variable< T > &targets) |
Convenience operator for computing loss. | |
Binary Cross Entropy Loss with autograd support.
BCE(y_pred, y_true) = -[y_true * log(y_pred) + (1 - y_true) * log(1 - y_pred)]
Commonly used for binary classification.
Definition at line 121 of file losses.hpp.
|
inlineexplicit |
Constructor.
reduction | Type of reduction ('mean', 'sum', 'none') |
Definition at line 127 of file losses.hpp.
|
overridevirtual |
Forward pass: compute binary cross entropy loss.
predictions | Predicted probabilities (after sigmoid) |
targets | Binary target values (0 or 1) |
Implements dl::loss::AutogradLoss< T >.
Definition at line 86 of file losses.cpp.