[mlpack-git] master: The transform() function isn't available on armadillo 3.6 so we move back to a standard for loop. (f601eae)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Sat Aug 29 10:08:01 EDT 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/be6fe1f5cebdce38935cf2a5b628fb3196578dc7...f601eaebcd70f940b3cc52b29802cbe6a88a7c37
>---------------------------------------------------------------
commit f601eaebcd70f940b3cc52b29802cbe6a88a7c37
Author: Marcus Edel <marcus.edel at fu-berlin.de>
Date: Sat Aug 29 16:07:55 2015 +0200
The transform() function isn't available on armadillo 3.6 so we move back to a standard for loop.
>---------------------------------------------------------------
f601eaebcd70f940b3cc52b29802cbe6a88a7c37
src/mlpack/methods/ann/activation_functions/logistic_function.hpp | 4 +++-
src/mlpack/methods/ann/layer/binary_classification_layer.hpp | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/mlpack/methods/ann/activation_functions/logistic_function.hpp b/src/mlpack/methods/ann/activation_functions/logistic_function.hpp
index e8b5d60..b388c3f 100644
--- a/src/mlpack/methods/ann/activation_functions/logistic_function.hpp
+++ b/src/mlpack/methods/ann/activation_functions/logistic_function.hpp
@@ -54,7 +54,9 @@ class LogisticFunction
static void fn(const InputVecType& x, OutputVecType& y)
{
y = x;
- y.transform( [](double x) { return fn(x); } );
+
+ for (size_t i = 0; i < x.n_elem; i++)
+ y(i) = fn(x(i));
}
/**
diff --git a/src/mlpack/methods/ann/layer/binary_classification_layer.hpp b/src/mlpack/methods/ann/layer/binary_classification_layer.hpp
index bd44a89..ad5d30a 100644
--- a/src/mlpack/methods/ann/layer/binary_classification_layer.hpp
+++ b/src/mlpack/methods/ann/layer/binary_classification_layer.hpp
@@ -56,7 +56,9 @@ class BinaryClassificationLayer
void OutputClass(const DataType& inputActivations, DataType& output)
{
output = inputActivations;
- output.transform( [](double value) { return (value > 0.5 ? 1 : 0); } );
+
+ for (size_t i = 0; i < output.n_elem; i++)
+ output(i) = output(i) > 0.5 ? 1 : 0;
}
}; // class BinaryClassificationLayer
More information about the mlpack-git
mailing list