Deprecate ForwardPrefilled(), Forward(bottom, loss) in lieu of dropping
authorEvan Shelhamer <shelhamer@imaginarynumber.net>
Sat, 27 Feb 2016 06:20:50 +0000 (22:20 -0800)
committerEvan Shelhamer <shelhamer@imaginarynumber.net>
Sat, 27 Feb 2016 06:37:50 +0000 (22:37 -0800)
Relax removal of `Forward()` variations by deprecating instead.

include/caffe/net.hpp
src/caffe/net.cpp

index 1c2a191..0addb3c 100644 (file)
@@ -36,6 +36,12 @@ class Net {
    *
    */
   const vector<Blob<Dtype>*>& Forward(Dtype* loss = NULL);
+  /// @brief DEPRECATED; use Forward() instead.
+  const vector<Blob<Dtype>*>& ForwardPrefilled(Dtype* loss = NULL) {
+    LOG_EVERY_N(WARNING, 1000) << "DEPRECATED: ForwardPrefilled() "
+        << "will be removed in a future version. Use Forward().";
+    return Forward(loss);
+  }
 
   /**
    * The From and To variants of Forward and Backward operate on the
@@ -48,6 +54,9 @@ class Net {
   Dtype ForwardFromTo(int start, int end);
   Dtype ForwardFrom(int start);
   Dtype ForwardTo(int end);
+  /// @brief DEPRECATED; set input blobs then use Forward() instead.
+  const vector<Blob<Dtype>*>& Forward(const vector<Blob<Dtype>* > & bottom,
+      Dtype* loss = NULL);
 
   /**
    * @brief Zeroes out the diffs of all net parameters.
index c1760ea..23d94c9 100644 (file)
@@ -567,6 +567,18 @@ const vector<Blob<Dtype>*>& Net<Dtype>::Forward(Dtype* loss) {
 }
 
 template <typename Dtype>
+const vector<Blob<Dtype>*>& Net<Dtype>::Forward(
+    const vector<Blob<Dtype>*> & bottom, Dtype* loss) {
+  LOG_EVERY_N(WARNING, 1000) << "DEPRECATED: Forward(bottom, loss) "
+      << "will be removed in a future version. Use Forward(loss).";
+  // Copy bottom to net bottoms
+  for (int i = 0; i < bottom.size(); ++i) {
+    net_input_blobs_[i]->CopyFrom(*bottom[i]);
+  }
+  return Forward(loss);
+}
+
+template <typename Dtype>
 void Net<Dtype>::BackwardFromTo(int start, int end) {
   CHECK_GE(end, 0);
   CHECK_LT(start, layers_.size());