--- /dev/null
+#ifndef CAFFE_PARAMETER_LAYER_HPP_
+#define CAFFE_PARAMETER_LAYER_HPP_
+
+#include <vector>
+
+#include "caffe/layer.hpp"
+
+namespace caffe {
+
+template <typename Dtype>
+class ParameterLayer : public Layer<Dtype> {
+ public:
+ explicit ParameterLayer(const LayerParameter& param)
+ : Layer<Dtype>(param) {}
+ virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom,
+ const vector<Blob<Dtype>*>& top) {
+ if (this->blobs_.size() > 0) {
+ LOG(INFO) << "Skipping parameter initialization";
+ } else {
+ this->blobs_.resize(1);
+ this->blobs_[0].reset(new Blob<Dtype>());
+ this->blobs_[0]->Reshape(this->layer_param_.parameter_param().shape());
+ }
+ top[0]->Reshape(this->layer_param_.parameter_param().shape());
+ }
+ virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
+ const vector<Blob<Dtype>*>& top) { }
+ virtual inline const char* type() const { return "Parameter"; }
+ virtual inline int ExactNumBottomBlobs() const { return 0; }
+ virtual inline int ExactNumTopBlobs() const { return 1; }
+
+ protected:
+ virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
+ const vector<Blob<Dtype>*>& top) {
+ top[0]->ShareData(*(this->blobs_[0]));
+ top[0]->ShareDiff(*(this->blobs_[0]));
+ }
+ virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
+ const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom)
+ { }
+};
+
+} // namespace caffe
+
+#endif
// NOTE
// Update the next available ID when you add a new LayerParameter field.
//
-// LayerParameter next available layer-specific ID: 145 (last added: crop_param)
+// LayerParameter next available layer-specific ID: 146 (last added: parameter_param)
message LayerParameter {
optional string name = 1; // the layer name
optional string type = 2; // the layer type
optional LRNParameter lrn_param = 118;
optional MemoryDataParameter memory_data_param = 119;
optional MVNParameter mvn_param = 120;
+ optional ParameterParameter parameter_param = 145;
optional PoolingParameter pooling_param = 121;
optional PowerParameter power_param = 122;
optional PReLUParameter prelu_param = 131;
optional float eps = 3 [default = 1e-9];
}
+message ParameterParameter {
+ optional BlobShape shape = 1;
+}
+
message PoolingParameter {
enum PoolMethod {
MAX = 0;