nnlib
GPU-accelerated, C/C++ neural network library.
|
Class representing the Categorical Cross Entropy. More...
#include <loss.h>
Public Member Functions | |
sTensor | calculateLoss (const sTensor &targets, const sTensor &predictions) override |
std::string | getShortName () const override |
Short string identifier of the metric. More... | |
![]() | |
Loss () | |
Constructor for the Loss class. More... | |
float | calculateMetric (const sTensor &targets, const sTensor &predictions) override |
Defines the method inherited from abstract Metric parent. More... | |
![]() | |
Metric () | |
Constructor for the Metric class. More... | |
void | reset () |
Reset the metric, i.e.: set numSamples and currentTotalMetric to 0. | |
Additional Inherited Members | |
![]() | |
size_t | numSamples |
The number of samples processed so far. | |
float | currentTotalMetric |
The current total value of the metric. | |
Class representing the Categorical Cross Entropy.
This loss expects the targets to be in shape (batchSize, numClasses), where each row contains only a single 1 and numClasses - 1
0s.
The sum of predictions doesn't have to be 1. The sum will be auto-normalized when calculating the loss and the derivatives.
|
overridevirtual |
Short string identifier of the metric.
Used when printing the value of the metric to the terminal.
Implements Metric.