1 #ifndef CAFFE_SIGMOID_CROSS_ENTROPY_LOSS_LAYER_HPP_ 2 #define CAFFE_SIGMOID_CROSS_ENTROPY_LOSS_LAYER_HPP_ 6 #include "caffe/blob.hpp" 7 #include "caffe/layer.hpp" 8 #include "caffe/proto/caffe.pb.h" 10 #include "caffe/layers/loss_layer.hpp" 11 #include "caffe/layers/sigmoid_layer.hpp" 44 template <
typename Dtype>
56 virtual inline const char*
type()
const {
return "SigmoidCrossEntropyLoss"; }
96 const vector<bool>& propagate_down,
const vector<
Blob<Dtype>*>& bottom);
98 const vector<bool>& propagate_down,
const vector<
Blob<Dtype>*>& bottom);
105 LossParameter_NormalizationMode normalization_mode,
int valid_count);
123 int outer_num_, inner_num_;
128 #endif // CAFFE_SIGMOID_CROSS_ENTROPY_LOSS_LAYER_HPP_ vector< Blob< Dtype > * > sigmoid_bottom_vec_
bottom vector holder to call the underlying SigmoidLayer::Forward
Definition: sigmoid_cross_entropy_loss_layer.hpp:112
virtual void Forward_cpu(const vector< Blob< Dtype > *> &bottom, const vector< Blob< Dtype > *> &top)
Computes the cross-entropy (logistic) loss , often used for predicting targets interpreted as probabi...
Definition: sigmoid_cross_entropy_loss_layer.cpp:79
A layer factory that allows one to register layers. During runtime, registered layers can be called b...
Definition: blob.hpp:14
Sigmoid function non-linearity , a classic choice in neural networks.
Definition: sigmoid_layer.hpp:23
shared_ptr< Blob< Dtype > > sigmoid_output_
sigmoid_output stores the output of the SigmoidLayer.
Definition: sigmoid_cross_entropy_loss_layer.hpp:110
vector< Blob< Dtype > * > sigmoid_top_vec_
top vector holder to call the underlying SigmoidLayer::Forward
Definition: sigmoid_cross_entropy_loss_layer.hpp:114
LossParameter_NormalizationMode normalization_
How to normalize the loss.
Definition: sigmoid_cross_entropy_loss_layer.hpp:121
virtual Dtype get_normalizer(LossParameter_NormalizationMode normalization_mode, int valid_count)
Definition: sigmoid_cross_entropy_loss_layer.cpp:49
shared_ptr< SigmoidLayer< Dtype > > sigmoid_layer_
The internal SigmoidLayer used to map predictions to probabilities.
Definition: sigmoid_cross_entropy_loss_layer.hpp:108
virtual void LayerSetUp(const vector< Blob< Dtype > *> &bottom, const vector< Blob< Dtype > *> &top)
Does layer-specific setup: your layer should implement this function as well as Reshape.
Definition: sigmoid_cross_entropy_loss_layer.cpp:10
bool has_ignore_label_
Whether to ignore instances with a certain label.
Definition: sigmoid_cross_entropy_loss_layer.hpp:117
virtual const char * type() const
Returns the layer type.
Definition: sigmoid_cross_entropy_loss_layer.hpp:56
virtual void Backward_gpu(const vector< Blob< Dtype > *> &top, const vector< bool > &propagate_down, const vector< Blob< Dtype > *> &bottom)
Using the GPU device, compute the gradients for any parameters and for the bottom blobs if propagate_...
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: sigmoid_cross_entropy_loss_layer.cpp:36
Computes the cross-entropy (logistic) loss , often used for predicting targets interpreted as probabi...
Definition: sigmoid_cross_entropy_loss_layer.hpp:45
An interface for Layers that take two Blobs as input – usually (1) predictions and (2) ground-truth ...
Definition: loss_layer.hpp:23
virtual void Forward_gpu(const vector< Blob< Dtype > *> &bottom, const vector< Blob< Dtype > *> &top)
Using the GPU device, compute the layer output. Fall back to Forward_cpu() if unavailable.
virtual void Backward_cpu(const vector< Blob< Dtype > *> &top, const vector< bool > &propagate_down, const vector< Blob< Dtype > *> &bottom)
Computes the sigmoid cross-entropy loss error gradient w.r.t. the predictions.
Definition: sigmoid_cross_entropy_loss_layer.cpp:104
A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers...
Definition: blob.hpp:24
int ignore_label_
The label indicating that an instance should be ignored.
Definition: sigmoid_cross_entropy_loss_layer.hpp:119