[mlpack-git] master: implement serialize (ad598cc)
gitdub at mlpack.org
gitdub at mlpack.org
Sat Feb 27 03:24:02 EST 2016
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/a2e57d617e952f1ea2fda8a23e1c6bd2f78beb6d...1bedf15126f6bd0bc93a3233914ac95486a3c0da
>---------------------------------------------------------------
commit ad598ccccb9c954aa598c9043c446c97083d3a8c
Author: stereomatchingkiss <stereomatchingkiss at gmail.com>
Date: Sat Feb 27 16:24:02 2016 +0800
implement serialize
>---------------------------------------------------------------
ad598ccccb9c954aa598c9043c446c97083d3a8c
src/mlpack/methods/ann/layer/base_layer.hpp | 8 ++++++++
src/mlpack/methods/ann/layer/bias_layer.hpp | 9 +++++++++
2 files changed, 17 insertions(+)
diff --git a/src/mlpack/methods/ann/layer/base_layer.hpp b/src/mlpack/methods/ann/layer/base_layer.hpp
index 1b9f0d8..385e38c 100644
--- a/src/mlpack/methods/ann/layer/base_layer.hpp
+++ b/src/mlpack/methods/ann/layer/base_layer.hpp
@@ -134,6 +134,14 @@ class BaseLayer
//! Modify the delta.
OutputDataType& Delta() { return delta; }
+ /**
+ * Serialize the layer
+ */
+ template<typename Archive>
+ void Serialize(Archive& ar, const unsigned int /* version */)
+ {
+ }
+
private:
//! Locally-stored delta object.
OutputDataType delta;
diff --git a/src/mlpack/methods/ann/layer/bias_layer.hpp b/src/mlpack/methods/ann/layer/bias_layer.hpp
index 11d293d..bb29deb 100644
--- a/src/mlpack/methods/ann/layer/bias_layer.hpp
+++ b/src/mlpack/methods/ann/layer/bias_layer.hpp
@@ -147,6 +147,15 @@ class BiasLayer
//! Modify the gradient.
InputDataType& Gradient() { return gradient; }
+ /**
+ * Serialize the layer
+ */
+ template<typename Archive>
+ void Serialize(Archive& ar, const unsigned int /* version */)
+ {
+ ar & data::CreateNVP(weights, "weights");
+ }
+
private:
//! Locally-stored number of output units.
size_t outSize;
More information about the mlpack-git
mailing list