Caffe2 - C++ API
A deep learning, cross platform ML framework
loss_op.h
1 #ifndef CAFFE2_OPERATORS_LOSS_OP_H_
2 #define CAFFE2_OPERATORS_LOSS_OP_H_
3 
4 #include "caffe2/core/context.h"
5 #include "caffe2/core/logging.h"
6 #include "caffe2/core/operator.h"
7 #include "caffe2/operators/reduction_ops.h"
8 #include "caffe2/operators/utility_ops.h"
9 #include "caffe2/utils/math.h"
10 
11 namespace caffe2 {
12 
13 // AveragedLoss takes in the input and produces the output loss value as
14 // the average of the input.
15 template <typename T, class Context>
16 class AveragedLoss final : public SumElementsOp<T, Context> {
17  public:
18  AveragedLoss(const OperatorDef& operator_def, Workspace* ws)
19  : SumElementsOp<T, Context>(operator_def, ws, true) {}
20  ~AveragedLoss() {}
21 };
22 
23 template <typename T, class Context>
24 class AveragedLossGradient final : public SumElementsGradientOp<T, Context> {
25  public:
26  AveragedLossGradient(const OperatorDef& operator_def, Workspace* ws)
27  : SumElementsGradientOp<T, Context>(operator_def, ws, true) {}
29 };
30 
31 } // namespace caffe2
32 
33 #endif // CAFFE2_OPERATORS_LOSS_OP_H_
Workspace is a class that holds all the related objects created during runtime: (1) all blobs...
Definition: workspace.h:47
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...