[caffe] 04/05: patch: refresh, remove unused, pick upstream updates

Zhou Mo cdluminate-guest at moszumanska.debian.org
Wed Mar 15 08:58:26 UTC 2017


This is an automated email from the git hooks/post-receive script.

cdluminate-guest pushed a commit to branch master
in repository caffe.

commit 3ea3d6b2b96f6e2700a077904a25c305d8faaef9
Author: Zhou Mo <cdluminate at gmail.com>
Date:   Wed Mar 15 08:09:56 2017 +0000

    patch: refresh, remove unused, pick upstream updates
---
 debian/changelog                                   |   4 +
 debian/patches/cmake-avoid-argument-missing        |  17 --
 debian/patches/cmake-bump-soversion-to-rc4.patch   |  24 ---
 debian/patches/cmake-fix-python-module-installdir  |   3 +-
 debian/patches/cmake-link-correct-python-lib.patch |   4 +-
 debian/patches/cmake-using-basic-blas              |  24 +--
 debian/patches/cmake-using-gnuinstalldirs          |   2 +-
 .../fix-more-float-comparison-precision-issue      |  14 +-
 debian/patches/post_rc5_upstream_updates.patch     | 174 +++++++++++++++++++++
 debian/patches/series                              |   3 +-
 10 files changed, 194 insertions(+), 75 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 56637e4..fc59dcd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,10 @@ caffe (1.0.0~rc5-1) UNRELEASED; urgency=medium
 
   * New upstream RC release.
   * Update CAFFE_SOVER and get-orig-source target in rules.
+  * Update patches:
+    - Remove cmake-avoid-argument-missing, cmake-bump-soversion-to-rc4.patch .
+    - Refresh the other patches.
+    - Cherry-pick upstream updates to rc5: post_rc5_upstream_updates.patch .
 
  -- Zhou Mo <cdluminate at gmail.com>  Wed, 15 Mar 2017 07:33:12 +0000
 
diff --git a/debian/patches/cmake-avoid-argument-missing b/debian/patches/cmake-avoid-argument-missing
deleted file mode 100644
index 72f4909..0000000
--- a/debian/patches/cmake-avoid-argument-missing
+++ /dev/null
@@ -1,17 +0,0 @@
-Purpose: avoid this cmake error:
-    CMake Error at cmake/ConfigGen.cmake:95 (list):
-      list sub-command REMOVE_ITEM requires two or more arguments.
-    Call Stack (most recent call first):
-      CMakeLists.txt:93 (caffe_generate_export_configs)
-Forward: not yet.
---- a/cmake/ConfigGen.cmake
-+++ b/cmake/ConfigGen.cmake
-@@ -92,7 +92,7 @@
-   # remove source and build dir includes
-   caffe_get_items_with_prefix(${PROJECT_SOURCE_DIR} Caffe_INCLUDE_DIRS __insource)
-   caffe_get_items_with_prefix(${PROJECT_BINARY_DIR} Caffe_INCLUDE_DIRS __inbinary)
--  list(REMOVE_ITEM Caffe_INCLUDE_DIRS ${__insource} ${__inbinary})
-+  list(REMOVE_ITEM Caffe_INCLUDE_DIRS ${__insource} ${__inbinary} "")
- 
-   # add `install` include folder
-   set(lines
diff --git a/debian/patches/cmake-bump-soversion-to-rc4.patch b/debian/patches/cmake-bump-soversion-to-rc4.patch
deleted file mode 100644
index 825ef95..0000000
--- a/debian/patches/cmake-bump-soversion-to-rc4.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Description: fix soversion
-Forward: https://github.com/BVLC/caffe/pull/5207
-
-commit 135440371c7cb2932d5c1e8e671e0d2e231fd2cc
-Author: Zhou Mo <cdluminate at gmail.com>
-Date:   Sat Jan 21 03:06:38 2017 +0000
-
-    cmake: bump soversion to rc4
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 3af394f7..15a7fe46 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -10,8 +10,8 @@ endif()
- project(Caffe C CXX)
- 
- # ---[ Caffe version
--set(CAFFE_TARGET_VERSION "1.0.0-rc3" CACHE STRING "Caffe logical version")
--set(CAFFE_TARGET_SOVERSION "1.0.0-rc3" CACHE STRING "Caffe soname version")
-+set(CAFFE_TARGET_VERSION "1.0.0-rc4" CACHE STRING "Caffe logical version")
-+set(CAFFE_TARGET_SOVERSION "1.0.0-rc4" CACHE STRING "Caffe soname version")
- add_definitions(-DCAFFE_VERSION=${CAFFE_TARGET_VERSION})
- 
- # ---[ Using cmake scripts and modules
diff --git a/debian/patches/cmake-fix-python-module-installdir b/debian/patches/cmake-fix-python-module-installdir
index b2020e9..1f9309b 100644
--- a/debian/patches/cmake-fix-python-module-installdir
+++ b/debian/patches/cmake-fix-python-module-installdir
@@ -21,11 +21,10 @@ Forward: Don't forward, Debian-specific.
  
 --- a/src/caffe/CMakeLists.txt
 +++ b/src/caffe/CMakeLists.txt
-@@ -35,6 +35,6 @@
+@@ -46,5 +46,5 @@
  
  file(WRITE ${PROJECT_BINARY_DIR}/__init__.py)
  list(APPEND proto_python ${PROJECT_BINARY_DIR}/__init__.py)
 -install(PROGRAMS ${proto_python} DESTINATION python/caffe/proto)
 +install(PROGRAMS ${proto_python} DESTINATION lib/python3/dist-packages/caffe/proto)
  
- 
diff --git a/debian/patches/cmake-link-correct-python-lib.patch b/debian/patches/cmake-link-correct-python-lib.patch
index b55a76d..7149a4e 100644
--- a/debian/patches/cmake-link-correct-python-lib.patch
+++ b/debian/patches/cmake-link-correct-python-lib.patch
@@ -1,10 +1,8 @@
 Description: fix BTBFS bug #850989
 Forward: keep it here.
-diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
-index ae9ce8e..87d0858 100644
 --- a/cmake/Dependencies.cmake
 +++ b/cmake/Dependencies.cmake
-@@ -137,7 +137,8 @@ if(BUILD_python)
+@@ -166,7 +166,8 @@
        endif()
      endwhile()
      if(NOT Boost_PYTHON_FOUND)
diff --git a/debian/patches/cmake-using-basic-blas b/debian/patches/cmake-using-basic-blas
index 5debf88..482b2b5 100644
--- a/debian/patches/cmake-using-basic-blas
+++ b/debian/patches/cmake-using-basic-blas
@@ -4,25 +4,17 @@ of directly openblas or atlas.
 
 Forwarded: yes
 https://github.com/BVLC/caffe/pull/4238
+
 --- a/cmake/Dependencies.cmake
 +++ b/cmake/Dependencies.cmake
-@@ -81,7 +81,7 @@
- 
- # ---[ BLAS
- if(NOT APPLE)
--  set(BLAS "Atlas" CACHE STRING "Selected BLAS library")
-+  set(BLAS "Generic" CACHE STRING "Selected BLAS library")
-   set_property(CACHE BLAS PROPERTY STRINGS "Atlas;Open;MKL")
- 
-   if(BLAS STREQUAL "Atlas" OR BLAS STREQUAL "atlas")
-@@ -97,6 +97,10 @@
-     include_directories(SYSTEM ${MKL_INCLUDE_DIR})
-     list(APPEND Caffe_LINKER_LIBS ${MKL_LIBRARIES})
-     add_definitions(-DUSE_MKL)
+@@ -113,6 +113,10 @@ if(NOT APPLE)
+     find_package(Atlas REQUIRED)
+     list(APPEND Caffe_INCLUDE_DIRS PUBLIC ${Atlas_INCLUDE_DIR})
+     list(APPEND Caffe_LINKER_LIBS PUBLIC ${Atlas_LIBRARIES})
 +  elseif(BLAS STREQUAL "Generic")
 +    set(BLA_VENDOR "Generic")
 +    find_package(BLAS REQUIRED)
 +    list(APPEND Caffe_LINKER_LIBS ${BLAS_LIBRARIES})
-   endif()
- elseif(APPLE)
-   find_package(vecLib REQUIRED)
+   elseif(BLAS STREQUAL "Open" OR BLAS STREQUAL "open")
+     find_package(OpenBLAS REQUIRED)
+     list(APPEND Caffe_INCLUDE_DIRS PUBLIC ${OpenBLAS_INCLUDE_DIR})
diff --git a/debian/patches/cmake-using-gnuinstalldirs b/debian/patches/cmake-using-gnuinstalldirs
index 3e0f138..b7837d1 100644
--- a/debian/patches/cmake-using-gnuinstalldirs
+++ b/debian/patches/cmake-using-gnuinstalldirs
@@ -14,7 +14,7 @@ https://github.com/BVLC/caffe/pull/4237
  include(cmake/Targets.cmake)
 --- a/src/caffe/CMakeLists.txt
 +++ b/src/caffe/CMakeLists.txt
-@@ -29,9 +29,9 @@
+@@ -40,9 +40,9 @@
   add_subdirectory(test)
  
  # ---[ Install
diff --git a/debian/patches/fix-more-float-comparison-precision-issue b/debian/patches/fix-more-float-comparison-precision-issue
index 56ebcc6..2f8e248 100644
--- a/debian/patches/fix-more-float-comparison-precision-issue
+++ b/debian/patches/fix-more-float-comparison-precision-issue
@@ -11,11 +11,9 @@ Date:   Tue Aug 9 15:13:47 2016 +0000
     
     This fix changes some EXPECT_EQ into EXPECT_FLOAT_EQ .
 
-diff --git a/src/caffe/test/test_convolution_layer.cpp b/src/caffe/test/test_convolution_layer.cpp
-index 9bb19d1..85c10a2 100644
 --- a/src/caffe/test/test_convolution_layer.cpp
 +++ b/src/caffe/test/test_convolution_layer.cpp
-@@ -695,7 +695,7 @@ TYPED_TEST(ConvolutionLayerTest, TestNDAgainst2D) {
+@@ -695,7 +695,7 @@
    }
    ASSERT_EQ(backward_result_nd.count(), backward_result_2d.count());
    for (int i = 0; i < backward_result_2d.count(); ++i) {
@@ -24,11 +22,9 @@ index 9bb19d1..85c10a2 100644
                backward_result_nd.cpu_diff()[i]);
    }
    ASSERT_EQ(backward_weight_result_nd.count(),
-diff --git a/src/caffe/test/test_gradient_based_solver.cpp b/src/caffe/test/test_gradient_based_solver.cpp
-index 975a8f0..9395f4e 100644
 --- a/src/caffe/test/test_gradient_based_solver.cpp
 +++ b/src/caffe/test/test_gradient_based_solver.cpp
-@@ -538,9 +538,9 @@ class GradientBasedSolverTest : public MultiDeviceTest<TypeParam> {
+@@ -558,9 +558,9 @@
      const vector<Blob<Dtype>*>& params = solver_->net()->learnable_params();
      for (int i = 0; i < params.size(); ++i) {
        for (int j = 0; j < params[i]->count(); ++j) {
@@ -40,7 +36,7 @@ index 975a8f0..9395f4e 100644
              << "param " << i << " diff differed at dim " << j;
        }
      }
-@@ -549,9 +549,9 @@ class GradientBasedSolverTest : public MultiDeviceTest<TypeParam> {
+@@ -569,9 +569,9 @@
      const vector<shared_ptr<Blob<Dtype> > >& history = solver_->history();
      for (int i = 0; i < history.size(); ++i) {
        for (int j = 0; j < history[i]->count(); ++j) {
@@ -52,11 +48,9 @@ index 975a8f0..9395f4e 100644
              << "history blob " << i << " diff differed at dim " << j;
        }
      }
-diff --git a/src/caffe/test/test_neuron_layer.cpp b/src/caffe/test/test_neuron_layer.cpp
-index 342f825..57bd47b 100644
 --- a/src/caffe/test/test_neuron_layer.cpp
 +++ b/src/caffe/test/test_neuron_layer.cpp
-@@ -791,16 +791,16 @@ TYPED_TEST(NeuronLayerTest, TestPReLUInPlace) {
+@@ -791,16 +791,16 @@
    ip2.Backward(blob_middle_vec_2, propagate_down, blob_bottom_vec_2);
    // Check numbers
    for (int s = 0; s < blob_bottom_2->count(); ++s) {
diff --git a/debian/patches/post_rc5_upstream_updates.patch b/debian/patches/post_rc5_upstream_updates.patch
new file mode 100644
index 0000000..b822197
--- /dev/null
+++ b/debian/patches/post_rc5_upstream_updates.patch
@@ -0,0 +1,174 @@
+diff --git a/docs/tutorial/layers.md b/docs/tutorial/layers.md
+index a903d5ac..2faacc58 100644
+--- a/docs/tutorial/layers.md
++++ b/docs/tutorial/layers.md
+@@ -128,7 +128,7 @@ Layers:
+ * [Infogain Loss](layers/infogainloss.html) - a generalization of MultinomialLogisticLossLayer.
+ * [Softmax with Loss](layers/softmaxwithloss.html) - computes the multinomial logistic loss of the softmax of its inputs. It's conceptually identical to a softmax layer followed by a multinomial logistic loss layer, but provides a more numerically stable gradient.
+ * [Sum-of-Squares / Euclidean](layers/euclideanloss.html) - computes the sum of squares of differences of its two inputs, $$\frac 1 {2N} \sum_{i=1}^N \| x^1_i - x^2_i \|_2^2$$.
+-* [Hinge / Margin](layers/hiddenloss.html) - The hinge loss layer computes a one-vs-all hinge (L1) or squared hinge loss (L2).
++* [Hinge / Margin](layers/hingeloss.html) - The hinge loss layer computes a one-vs-all hinge (L1) or squared hinge loss (L2).
+ * [Sigmoid Cross-Entropy Loss](layers/sigmoidcrossentropyloss.html) - computes the cross-entropy (logistic) loss, often used for predicting targets interpreted as probabilities.
+ * [Accuracy / Top-k layer](layers/accuracy.html) - scores the output as an accuracy with respect to target -- it is not actually a loss and has no backward step.
+ * [Contrastive Loss](layers/contrastiveloss.html)
+diff --git a/include/caffe/util/hdf5.hpp b/include/caffe/util/hdf5.hpp
+index ce568c5e..71549c1c 100644
+--- a/include/caffe/util/hdf5.hpp
++++ b/include/caffe/util/hdf5.hpp
+@@ -13,12 +13,12 @@ namespace caffe {
+ template <typename Dtype>
+ void hdf5_load_nd_dataset_helper(
+     hid_t file_id, const char* dataset_name_, int min_dim, int max_dim,
+-    Blob<Dtype>* blob);
++    Blob<Dtype>* blob, bool reshape);
+ 
+ template <typename Dtype>
+ void hdf5_load_nd_dataset(
+     hid_t file_id, const char* dataset_name_, int min_dim, int max_dim,
+-    Blob<Dtype>* blob);
++    Blob<Dtype>* blob, bool reshape = false);
+ 
+ template <typename Dtype>
+ void hdf5_save_nd_dataset(
+diff --git a/python/caffe/_caffe.cpp b/python/caffe/_caffe.cpp
+index 3589e476..be011699 100644
+--- a/python/caffe/_caffe.cpp
++++ b/python/caffe/_caffe.cpp
+@@ -288,7 +288,7 @@ void Solver_add_callback(Solver<Dtype> * solver, bp::object on_start,
+ }
+ 
+ // Seems boost cannot call the base method directly
+-void Solver_add_nccl(SGDSolver<Dtype>* solver
++void Solver_add_nccl(Solver<Dtype>* solver
+ #ifdef USE_NCCL
+   , NCCL<Dtype>* nccl
+ #endif
+diff --git a/src/caffe/layers/hdf5_data_layer.cpp b/src/caffe/layers/hdf5_data_layer.cpp
+index b9a071ce..00716a92 100644
+--- a/src/caffe/layers/hdf5_data_layer.cpp
++++ b/src/caffe/layers/hdf5_data_layer.cpp
+@@ -39,8 +39,9 @@ void HDF5DataLayer<Dtype>::LoadHDF5FileData(const char* filename) {
+ 
+   for (int i = 0; i < top_size; ++i) {
+     hdf_blobs_[i] = shared_ptr<Blob<Dtype> >(new Blob<Dtype>());
++    // Allow reshape here, as we are loading data not params
+     hdf5_load_nd_dataset(file_id, this->layer_param_.top(i).c_str(),
+-        MIN_DATA_DIM, MAX_DATA_DIM, hdf_blobs_[i].get());
++        MIN_DATA_DIM, MAX_DATA_DIM, hdf_blobs_[i].get(), true);
+   }
+ 
+   herr_t status = H5Fclose(file_id);
+diff --git a/src/caffe/test/test_hdf5_output_layer.cpp b/src/caffe/test/test_hdf5_output_layer.cpp
+index 3833ebff..2bc2de1e 100644
+--- a/src/caffe/test/test_hdf5_output_layer.cpp
++++ b/src/caffe/test/test_hdf5_output_layer.cpp
+@@ -77,10 +77,12 @@ TYPED_TEST(HDF5OutputLayerTest, TestForward) {
+                           H5P_DEFAULT);
+   ASSERT_GE(file_id, 0)<< "Failed to open HDF5 file" <<
+       this->input_file_name_;
++  // Allow reshape here as we are loading data not params
++  bool reshape = true;
+   hdf5_load_nd_dataset(file_id, HDF5_DATA_DATASET_NAME, 0, 4,
+-                       this->blob_data_);
++                       this->blob_data_, reshape);
+   hdf5_load_nd_dataset(file_id, HDF5_DATA_LABEL_NAME, 0, 4,
+-                       this->blob_label_);
++                       this->blob_label_, reshape);
+   herr_t status = H5Fclose(file_id);
+   EXPECT_GE(status, 0)<< "Failed to close HDF5 file " <<
+       this->input_file_name_;
+@@ -105,12 +107,12 @@ TYPED_TEST(HDF5OutputLayerTest, TestForward) {
+ 
+   Blob<Dtype>* blob_data = new Blob<Dtype>();
+   hdf5_load_nd_dataset(file_id, HDF5_DATA_DATASET_NAME, 0, 4,
+-                       blob_data);
++                       blob_data, reshape);
+   this->CheckBlobEqual(*(this->blob_data_), *blob_data);
+ 
+   Blob<Dtype>* blob_label = new Blob<Dtype>();
+   hdf5_load_nd_dataset(file_id, HDF5_DATA_LABEL_NAME, 0, 4,
+-                       blob_label);
++                       blob_label, reshape);
+   this->CheckBlobEqual(*(this->blob_label_), *blob_label);
+ 
+   status = H5Fclose(file_id);
+diff --git a/src/caffe/test/test_hdf5data_layer.cpp b/src/caffe/test/test_hdf5data_layer.cpp
+index 68e10286..487f5176 100644
+--- a/src/caffe/test/test_hdf5data_layer.cpp
++++ b/src/caffe/test/test_hdf5data_layer.cpp
+@@ -70,7 +70,7 @@ TYPED_TEST(HDF5DataLayerTest, TestRead) {
+   int height = 6;
+   int width = 5;
+ 
+-  // Test that the layer setup got the correct parameters.
++  // Test that the layer setup gives correct parameters.
+   HDF5DataLayer<Dtype> layer(param);
+   layer.SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
+   EXPECT_EQ(this->blob_top_data_->num(), batch_size);
+diff --git a/src/caffe/util/hdf5.cpp b/src/caffe/util/hdf5.cpp
+index d255877b..ed737429 100644
+--- a/src/caffe/util/hdf5.cpp
++++ b/src/caffe/util/hdf5.cpp
+@@ -9,7 +9,7 @@ namespace caffe {
+ template <typename Dtype>
+ void hdf5_load_nd_dataset_helper(
+     hid_t file_id, const char* dataset_name_, int min_dim, int max_dim,
+-    Blob<Dtype>* blob) {
++    Blob<Dtype>* blob, bool reshape) {
+   // Verify that the dataset exists.
+   CHECK(H5LTfind_dataset(file_id, dataset_name_))
+       << "Failed to find HDF5 dataset " << dataset_name_;
+@@ -56,17 +56,38 @@ void hdf5_load_nd_dataset_helper(
+     LOG(FATAL) << "Datatype class unknown";
+   }
+ 
++
+   vector<int> blob_dims(dims.size());
+   for (int i = 0; i < dims.size(); ++i) {
+     blob_dims[i] = dims[i];
+   }
+-  blob->Reshape(blob_dims);
++
++  if (reshape) {
++    blob->Reshape(blob_dims);
++  } else {
++    if (blob_dims != blob->shape()) {
++      // create shape string for error message
++      ostringstream stream;
++      int count = 1;
++      for (int i = 0; i < blob_dims.size(); ++i) {
++        stream << blob_dims[i] << " ";
++        count = count * blob_dims[i];
++      }
++      stream << "(" << count << ")";
++      string source_shape_string = stream.str();
++
++      CHECK(blob_dims == blob->shape()) << "Cannot load blob from hdf5; shape "
++            << "mismatch. Source shape is " << source_shape_string
++            << " target shape is " << blob->shape_string();
++    }
++  }
+ }
+ 
+ template <>
+ void hdf5_load_nd_dataset<float>(hid_t file_id, const char* dataset_name_,
+-        int min_dim, int max_dim, Blob<float>* blob) {
+-  hdf5_load_nd_dataset_helper(file_id, dataset_name_, min_dim, max_dim, blob);
++        int min_dim, int max_dim, Blob<float>* blob, bool reshape) {
++  hdf5_load_nd_dataset_helper(file_id, dataset_name_, min_dim, max_dim, blob,
++                              reshape);
+   herr_t status = H5LTread_dataset_float(
+     file_id, dataset_name_, blob->mutable_cpu_data());
+   CHECK_GE(status, 0) << "Failed to read float dataset " << dataset_name_;
+@@ -74,8 +95,9 @@ void hdf5_load_nd_dataset<float>(hid_t file_id, const char* dataset_name_,
+ 
+ template <>
+ void hdf5_load_nd_dataset<double>(hid_t file_id, const char* dataset_name_,
+-        int min_dim, int max_dim, Blob<double>* blob) {
+-  hdf5_load_nd_dataset_helper(file_id, dataset_name_, min_dim, max_dim, blob);
++        int min_dim, int max_dim, Blob<double>* blob, bool reshape) {
++  hdf5_load_nd_dataset_helper(file_id, dataset_name_, min_dim, max_dim, blob,
++                              reshape);
+   herr_t status = H5LTread_dataset_double(
+     file_id, dataset_name_, blob->mutable_cpu_data());
+   CHECK_GE(status, 0) << "Failed to read double dataset " << dataset_name_;
diff --git a/debian/patches/series b/debian/patches/series
index e58e8e2..ee52507 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,8 +1,7 @@
 cmake-using-basic-blas
 cmake-using-gnuinstalldirs
 cmake-fix-python-module-installdir
-cmake-avoid-argument-missing
 fix-more-float-comparison-precision-issue
 fix-more-float-comparison-precision-issue2
 cmake-link-correct-python-lib.patch
-cmake-bump-soversion-to-rc4.patch
+post_rc5_upstream_updates.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/caffe.git



More information about the debian-science-commits mailing list