Caffe
hinge_loss_layer.hpp
1 #ifndef CAFFE_HINGE_LOSS_LAYER_HPP_
2 #define CAFFE_HINGE_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 
57 template <typename Dtype>
58 class HingeLossLayer : public LossLayer<Dtype> {
59  public:
60  explicit HingeLossLayer(const LayerParameter& param)
61  : LossLayer<Dtype>(param) {}
62 
63  virtual inline const char* type() const { return "HingeLoss"; }
64 
65  protected:
67  virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
68  const vector<Blob<Dtype>*>& top);
69 
97  virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
98  const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
99 };
100 
101 
102 } // namespace caffe
103 
104 #endif // CAFFE_HINGE_LOSS_LAYER_HPP_
A layer factory that allows one to register layers. During runtime, registered layers can be called b...
Definition: blob.hpp:14
virtual void Forward_cpu(const vector< Blob< Dtype > *> &bottom, const vector< Blob< Dtype > *> &top)
Computes the hinge loss for a one-of-many classification task.
Definition: hinge_loss_layer.cpp:10
Computes the hinge loss for a one-of-many classification task.
Definition: hinge_loss_layer.hpp:58
virtual void Backward_cpu(const vector< Blob< Dtype > *> &top, const vector< bool > &propagate_down, const vector< Blob< Dtype > *> &bottom)
Computes the hinge loss error gradient w.r.t. the predictions.
Definition: hinge_loss_layer.cpp:43
An interface for Layers that take two Blobs as input – usually (1) predictions and (2) ground-truth ...
Definition: loss_layer.hpp:23
virtual const char * type() const
Returns the layer type.
Definition: hinge_loss_layer.hpp:63
A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers...
Definition: blob.hpp:24