[mlpack-git] master: Add SFINAE pattern for the Gradient and Deterministic function. (d15ff95)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Sat Aug 29 08:23:29 EDT 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/ea45ace1ff744390a4c35183528eda881eda5c61...fd336238de224ed72fc23b84e1e2f02ae3c879d6
>---------------------------------------------------------------
commit d15ff9548b4914961425cf774a5488b9aaae8779
Author: Marcus Edel <marcus.edel at fu-berlin.de>
Date: Tue Aug 25 14:15:02 2015 +0200
Add SFINAE pattern for the Gradient and Deterministic function.
>---------------------------------------------------------------
d15ff9548b4914961425cf774a5488b9aaae8779
src/mlpack/methods/ann/layer/layer_traits.hpp | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/mlpack/methods/ann/layer/layer_traits.hpp b/src/mlpack/methods/ann/layer/layer_traits.hpp
index 0231171..a8be63a 100644
--- a/src/mlpack/methods/ann/layer/layer_traits.hpp
+++ b/src/mlpack/methods/ann/layer/layer_traits.hpp
@@ -8,6 +8,8 @@
#ifndef __MLPACK_METHODS_ANN_LAYER_LAYER_TRAITS_HPP
#define __MLPACK_METHODS_ANN_LAYER_LAYER_TRAITS_HPP
+#include <mlpack/core/util/sfinae_utility.hpp>
+
namespace mlpack {
namespace ann {
@@ -41,8 +43,22 @@ class LayerTraits
* This is true if the layer is a LSTM layer.
**/
static const bool IsLSTMLayer = false;
+
+ /*
+ * This is true if the layer is a connection layer.
+ **/
+ static const bool IsConnection = false;
};
+// This gives us a HasGradientCheck<T, U> type (where U is a function pointer)
+// we can use with SFINAE to catch when a type has a Gradient(...) function.
+HAS_MEM_FUNC(Gradient, HasGradientCheck);
+
+// This gives us a HasDeterministicCheck<T, U> type (where U is a function
+// pointer) we can use with SFINAE to catch when a type has a Deterministic()
+// function.
+HAS_MEM_FUNC(Deterministic, HasDeterministicCheck);
+
}; // namespace ann
}; // namespace mlpack
More information about the mlpack-git
mailing list