From: Evan Shelhamer Date: Wed, 26 Feb 2014 22:56:37 +0000 (-0800) Subject: Define split layer (merge trick) X-Git-Tag: submit/tizen/20180823.020014~756^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=527cfab7cf5b7fd7eff973851d96d6f6ea75807f;p=platform%2Fupstream%2Fcaffeonacl.git Define split layer (merge trick) Originally authored by Jeff Donahue, but this commit was needed for historical reasons. --- diff --git a/include/caffe/vision_layers.hpp b/include/caffe/vision_layers.hpp index 47909a2..1861535 100644 --- a/include/caffe/vision_layers.hpp +++ b/include/caffe/vision_layers.hpp @@ -126,6 +126,27 @@ class DropoutLayer : public NeuronLayer { template +class SplitLayer : public Layer { + public: + explicit SplitLayer(const LayerParameter& param) + : Layer(param) {} + virtual void SetUp(const vector*>& bottom, + vector*>* top); + + protected: + virtual void Forward_cpu(const vector*>& bottom, + vector*>* top); + virtual void Forward_gpu(const vector*>& bottom, + vector*>* top); + virtual Dtype Backward_cpu(const vector*>& top, + const bool propagate_down, vector*>* bottom); + virtual Dtype Backward_gpu(const vector*>& top, + const bool propagate_down, vector*>* bottom); + int count_; +}; + + +template class FlattenLayer : public Layer { public: explicit FlattenLayer(const LayerParameter& param) diff --git a/src/caffe/layer_factory.cpp b/src/caffe/layer_factory.cpp index cb65e8f..ff69c91 100644 --- a/src/caffe/layer_factory.cpp +++ b/src/caffe/layer_factory.cpp @@ -55,6 +55,8 @@ Layer* GetLayer(const LayerParameter& param) { return new SoftmaxLayer(param); } else if (type == "softmax_loss") { return new SoftmaxWithLossLayer(param); + } else if (type == "split") { + return new SplitLayer(param); } else if (type == "multinomial_logistic_loss") { return new MultinomialLogisticLossLayer(param); } else {