diff options
author | Jeff Donahue <jeff.donahue@gmail.com> | 2014-07-11 01:55:17 -0700 |
---|---|---|
committer | Jeff Donahue <jeff.donahue@gmail.com> | 2014-08-13 13:22:04 -0700 |
commit | 512a626fc71c69ed4460024b31c5fe8dff1e668c (patch) | |
tree | f3d11beb593a4e64e779a99b82538ceee7fae21a /src/caffe/layers/argmax_layer.cpp | |
parent | 7a3ed9b8edf43895770b63cb4d9f5cacf0dba047 (diff) | |
download | caffeonacl-512a626fc71c69ed4460024b31c5fe8dff1e668c.tar.gz caffeonacl-512a626fc71c69ed4460024b31c5fe8dff1e668c.tar.bz2 caffeonacl-512a626fc71c69ed4460024b31c5fe8dff1e668c.zip |
Generalize loss by allowing any top blob to be used as a loss in which
its elements are summed with a scalar coefficient.
Forward for layers no longer returns a loss; instead all loss layers must have
top blobs. Existing loss layers are given a top blob automatically by
Net::Init, with an associated top_loss_weight of 1 (set in
LossLayer::FurtherSetUp). Due to the increased amount of common SetUp logic,
the SetUp interface is modified such that all subclasses should normally
override FurtherSetUp only, which is called by SetUp.
Diffstat (limited to 'src/caffe/layers/argmax_layer.cpp')
-rw-r--r-- | src/caffe/layers/argmax_layer.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/caffe/layers/argmax_layer.cpp b/src/caffe/layers/argmax_layer.cpp index b2ef91ea..4b67f24c 100644 --- a/src/caffe/layers/argmax_layer.cpp +++ b/src/caffe/layers/argmax_layer.cpp @@ -9,9 +9,8 @@ namespace caffe { template <typename Dtype> -void ArgMaxLayer<Dtype>::SetUp(const vector<Blob<Dtype>*>& bottom, +void ArgMaxLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom, vector<Blob<Dtype>*>* top) { - Layer<Dtype>::SetUp(bottom, top); out_max_val_ = this->layer_param_.argmax_param().out_max_val(); top_k_ = this->layer_param_.argmax_param().top_k(); CHECK_GE(top_k_, 1) << " top k must not be less than 1."; @@ -27,7 +26,7 @@ void ArgMaxLayer<Dtype>::SetUp(const vector<Blob<Dtype>*>& bottom, } template <typename Dtype> -Dtype ArgMaxLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom, +void ArgMaxLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom, vector<Blob<Dtype>*>* top) { const Dtype* bottom_data = bottom[0]->cpu_data(); Dtype* top_data = (*top)[0]->mutable_cpu_data(); @@ -51,7 +50,6 @@ Dtype ArgMaxLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom, } } } - return Dtype(0); } INSTANTIATE_CLASS(ArgMaxLayer); |