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  template <class... Args>
19  explicit AveragedLoss(Args&&... args)
20  : SumElementsOp<T, Context>(std::forward<Args>(args)..., true) {}
21  ~AveragedLoss() {}
22 };
23 
24 template <typename T, class Context>
25 class AveragedLossGradient final : public SumElementsGradientOp<T, Context> {
26  public:
27  template <class... Args>
28  explicit AveragedLossGradient(Args&&... args)
29  : SumElementsGradientOp<T, Context>(std::forward<Args>(args)..., true) {}
30  ~AveragedLossGradient() {}
31 };
32 
33 } // namespace caffe2
34 
35 #endif // CAFFE2_OPERATORS_LOSS_OP_H_
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13