for (int i = 0; i < layers_.size(); ++i) {
LOG(INFO) << "Setting up " << layer_names_[i];
layers_[i]->SetUp(bottom_vecs_[i], &top_vecs_[i]);
+ vector<shared_ptr<Blob<Dtype> > >& layer_params = layers_[i].params();
+ for (int j = 0; j < layer_params.size(); ++j) {
+ params_.push_back(layer_params[j]);
+ }
}
+
LOG(INFO) << "Network initialization done.";
}
inline const vector<string>& blob_names() { return blob_names_; }
// returns the blobs
inline const vector<shared_ptr<Blob<Dtype> > >& blobs() { return blobs_; }
- // rethrns the layers
+ // returns the layers
inline const vector<shared_ptr<Layer<Dtype> > >& layers() { return layers_; }
+ // returns the parameters
+ vector<shared_ptr<Blob<Dtype> > >& params() { return params_; };
protected:
// Individual layers in the net
vector<int> net_input_blob_indices_;
vector<int> net_output_blob_indices_;
string name_;
+ // The parameters in the network.
+ vector<shared_ptr<Blob<Dtype> > > params_;
DISABLE_COPY_AND_ASSIGN(Net);
};
--- /dev/null
+#ifndef CAFFE_OPTIMIZATION_SOLVER_HPP_
+#define CAFFE_OPTIMIZATION_SOLVER_HPP_
+
+namespace caffe {
+
+class Solver {
+ public:
+ explicit Solver(const SolverParameter& param)
+ : param_(param) {}
+ void Solve(Net* net);
+
+ protected:
+ SolverParameter param_;
+};
+
+} // namspace caffe
+
+#endif // CAFFE_OPTIMIZATION_SOLVER_HPP_
\ No newline at end of file
repeated string bottom = 3; // The input to the network
repeated string top = 4; // The output of the network.
}
+
+message SolverParameter {
+ optional float base_lr = 1; // The base learning rate
+ optional int32 display = 2; // display options. 0 = no display
+ optional int32 max_iter = 3; // the maximum number of iterations
+ optional int32 snapshot = 4; // The snapshot interval
+ optional string lr_policy = 5; // The learning rate decay policy.
+ optional float min_lr = 6 [default = 0]; // The mininum learning rate
+ optional float max_lr = 7 [default = 1e10]; // The maximum learning rate
+ optional float gamma = 8; // The parameter to compute the learning rate.
+ optional float power = 9; // The parameter to compute the learning rate.
+ optional float momentum = 10; // The momentum value.
+}
\ No newline at end of file