| | #ifndef CAFFE_LOSS_LAYER_HPP_ |
| | #define CAFFE_LOSS_LAYER_HPP_ |
| |
|
| | #include <vector> |
| |
|
| | #include "caffe/blob.hpp" |
| | #include "caffe/layer.hpp" |
| | #include "caffe/proto/caffe.pb.h" |
| |
|
| | namespace caffe { |
| |
|
| | const float kLOG_THRESHOLD = 1e-20; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | template <typename Dtype> |
| | class LossLayer : public Layer<Dtype> { |
| | public: |
| | explicit LossLayer(const LayerParameter& param) |
| | : Layer<Dtype>(param) {} |
| | virtual void LayerSetUp( |
| | const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top); |
| | virtual void Reshape( |
| | const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top); |
| |
|
| | virtual inline int ExactNumBottomBlobs() const { return 2; } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | virtual inline bool AutoTopBlobs() const { return true; } |
| | virtual inline int ExactNumTopBlobs() const { return 1; } |
| | |
| | |
| | |
| | |
| | virtual inline bool AllowForceBackward(const int bottom_index) const { |
| | return bottom_index != 1; |
| | } |
| | }; |
| |
|
| | } |
| |
|
| | #endif |
| |
|