[mlpack-git] master: Check isinf() too. (09cd0d6)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Mon Oct 19 07:57:09 EDT 2015


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/ecf36c506a17b5f91f0d502a08e08075f8b0a024...09cd0d67f2fdae252a8ab85324e71dbb4dfe0010

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

commit 09cd0d67f2fdae252a8ab85324e71dbb4dfe0010
Author: ryan <ryan at ratml.org>
Date:   Mon Oct 19 07:56:54 2015 -0400

    Check isinf() too.


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

09cd0d67f2fdae252a8ab85324e71dbb4dfe0010
 src/mlpack/core/optimizers/sgd/sgd_impl.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mlpack/core/optimizers/sgd/sgd_impl.hpp b/src/mlpack/core/optimizers/sgd/sgd_impl.hpp
index 9b9a6e3..166c499 100644
--- a/src/mlpack/core/optimizers/sgd/sgd_impl.hpp
+++ b/src/mlpack/core/optimizers/sgd/sgd_impl.hpp
@@ -60,7 +60,7 @@ double SGD<DecomposableFunctionType>::Optimize(arma::mat& iterate)
       Log::Info << "SGD: iteration " << i << ", objective " << overallObjective
           << "." << std::endl;
 
-      if (std::isnan(overallObjective))
+      if (std::isnan(overallObjective) || std::isinf(overallObjective))
       {
         Log::Warn << "SGD: converged to " << overallObjective << "; terminating"
             << " with failure.  Try a smaller step size?" << std::endl;



More information about the mlpack-git mailing list