[mlpack-git] master: Issue a runtime error if the user is using Armadillo 4.300.x through 4.400.x and tries to load or save HDF5 files, since that is a bug in Armadillo. (fed7bf2)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 22:03:33 EST 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

>---------------------------------------------------------------

commit fed7bf245c0acd3061fb0703a4f041869146274e
Author: Ryan Curtin <ryan at ratml.org>
Date:   Tue Nov 18 22:55:49 2014 +0000

    Issue a runtime error if the user is using Armadillo 4.300.x through 4.400.x and
    tries to load or save HDF5 files, since that is a bug in Armadillo.


>---------------------------------------------------------------

fed7bf245c0acd3061fb0703a4f041869146274e
 src/mlpack/core/data/load_impl.hpp | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/mlpack/core/data/load_impl.hpp b/src/mlpack/core/data/load_impl.hpp
index 44f4e88..23731f0 100644
--- a/src/mlpack/core/data/load_impl.hpp
+++ b/src/mlpack/core/data/load_impl.hpp
@@ -142,6 +142,22 @@ bool Load(const std::string& filename,
 #ifdef ARMA_USE_HDF5
     loadType = arma::hdf5_binary;
     stringType = "HDF5 data";
+  #if ARMA_VERSION_MAJOR == 4 && \
+      (ARMA_VERSION_MINOR >= 300 && ARMA_VERSION_MINOR <= 400)
+    Timer::Stop("loading_data");
+    if (fatal)
+      Log::Fatal << "Attempted to load '" << filename << "' as HDF5 data, but "
+          << "Armadillo 4.300.0 through Armadillo 4.400.1 are known to have "
+          << "bugs and one of these versions is in use.  Load failed."
+          << std::endl;
+    else
+      Log::Warn << "Attempted to load '" << filename << "' as HDF5 data, but "
+          << "Armadillo 4.300.0 through Armadillo 4.400.1 are known to have "
+          << "bugs and one of these versions is in use.  Load failed."
+          << std::endl;
+
+    return false;
+  #endif
 #else
     Timer::Stop("loading_data");
     if (fatal)
@@ -185,6 +201,8 @@ bool Load(const std::string& filename,
     Log::Info << "Loading '" << filename << "' as " << stringType << ".  "
         << std::flush;
 
+  Log::Debug << "load type " << loadType << "\n";
+
   const bool success = matrix.load(stream, loadType);
 
   if (!success)



More information about the mlpack-git mailing list