construct Net from file and phase
authorEvan Shelhamer <shelhamer@imaginarynumber.net>
Sat, 24 Jan 2015 06:48:42 +0000 (22:48 -0800)
committerEvan Shelhamer <shelhamer@imaginarynumber.net>
Tue, 17 Feb 2015 19:35:51 +0000 (11:35 -0800)
include/caffe/net.hpp
src/caffe/net.cpp

index 153b881..075afeb 100644 (file)
@@ -24,7 +24,7 @@ template <typename Dtype>
 class Net {
  public:
   explicit Net(const NetParameter& param);
-  explicit Net(const string& param_file);
+  explicit Net(const string& param_file, Phase phase);
   virtual ~Net() {}
 
   /// @brief Initialize a network with a NetParameter.
index d1ae0bc..c359be9 100644 (file)
@@ -24,9 +24,10 @@ Net<Dtype>::Net(const NetParameter& param) {
 }
 
 template <typename Dtype>
-Net<Dtype>::Net(const string& param_file) {
+Net<Dtype>::Net(const string& param_file, Phase phase) {
   NetParameter param;
   ReadNetParamsFromTextFileOrDie(param_file, &param);
+  param.mutable_state()->set_phase(phase);
   Init(param);
 }