Caffe
multinomial_logistic_loss_layer.hpp
1 #ifndef CAFFE_MULTINOMIAL_LOGISTIC_LOSS_LAYER_HPP_
2 #define CAFFE_MULTINOMIAL_LOGISTIC_LOSS_LAYER_HPP_
3 
4 #include <vector>
5 
6 #include "caffe/blob.hpp"
7 #include "caffe/layer.hpp"
8 #include "caffe/proto/caffe.pb.h"
9 
10 #include "caffe/layers/loss_layer.hpp"
11 
12 namespace caffe {
13 
43 template <typename Dtype>
44 class MultinomialLogisticLossLayer : public LossLayer<Dtype> {
45  public:
46  explicit MultinomialLogisticLossLayer(const LayerParameter& param)
47  : LossLayer<Dtype>(param) {}
48  virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
49  const vector<Blob<Dtype>*>& top);
50 
51  virtual inline const char* type() const { return "MultinomialLogisticLoss"; }
52 
53  protected:
55  virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
56  const vector<Blob<Dtype>*>& top);
57 
86  virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
87  const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
88 };
89 
90 } // namespace caffe
91 
92 #endif // CAFFE_MULTINOMIAL_LOGISTIC_LOSS_LAYER_HPP_
virtual void Forward_cpu(const vector< Blob< Dtype > *> &bottom, const vector< Blob< Dtype > *> &top)
Computes the multinomial logistic loss for a one-of-many classification task, directly taking a predi...
Definition: multinomial_logistic_loss_layer.cpp:20
A layer factory that allows one to register layers. During runtime, registered layers can be called b...
Definition: blob.hpp:14
virtual const char * type() const
Returns the layer type.
Definition: multinomial_logistic_loss_layer.hpp:51
Computes the multinomial logistic loss for a one-of-many classification task, directly taking a predi...
Definition: multinomial_logistic_loss_layer.hpp:44
virtual void Reshape(const vector< Blob< Dtype > *> &bottom, const vector< Blob< Dtype > *> &top)
Adjust the shapes of top blobs and internal buffers to accommodate the shapes of the bottom blobs...
Definition: multinomial_logistic_loss_layer.cpp:11
virtual void Backward_cpu(const vector< Blob< Dtype > *> &top, const vector< bool > &propagate_down, const vector< Blob< Dtype > *> &bottom)
Computes the multinomial logistic loss error gradient w.r.t. the predictions.
Definition: multinomial_logistic_loss_layer.cpp:37
An interface for Layers that take two Blobs as input – usually (1) predictions and (2) ground-truth ...
Definition: loss_layer.hpp:23
A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers...
Definition: blob.hpp:24