[mlpack-git] master: only initialize variable once (b08ff03)

gitdub at mlpack.org gitdub at mlpack.org
Tue Apr 12 17:07:18 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/e0e7ba5353e5377b7ed87d5c364c0a7d446d737c...77532c84c6f4074a8668a78aa662879e5cf6ce4f

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

commit b08ff039693a00cbd15ca285721a25c210c96c0b
Author: stereomatchingkiss <stereomatchingkiss at gmail.com>
Date:   Wed Apr 13 05:07:18 2016 +0800

    only initialize variable once


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

b08ff039693a00cbd15ca285721a25c210c96c0b
 src/mlpack/methods/ann/layer/log_softmax_layer.hpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/mlpack/methods/ann/layer/log_softmax_layer.hpp b/src/mlpack/methods/ann/layer/log_softmax_layer.hpp
index 46414c0..cbfac4f 100644
--- a/src/mlpack/methods/ann/layer/log_softmax_layer.hpp
+++ b/src/mlpack/methods/ann/layer/log_softmax_layer.hpp
@@ -54,11 +54,11 @@ class LogSoftmaxLayer
     output.transform( [](double x)
     {
       //! Fast approximation of exp(-x) for x positive.
-      constexpr double A0 = 1.0;
-      constexpr double A1 = 0.125;
-      constexpr double A2 = 0.0078125;
-      constexpr double A3 = 0.00032552083;
-      constexpr double A4 = 1.0172526e-5;
+      static constexpr double A0 = 1.0;
+      static constexpr double A1 = 0.125;
+      static constexpr double A2 = 0.0078125;
+      static constexpr double A3 = 0.00032552083;
+      static constexpr double A4 = 1.0172526e-5;
 
       if (x < 13.0)
       {




More information about the mlpack-git mailing list