[mlpack-git] [mlpack] ANN Saving the network and reloading (#531)

Joseph Mariadassou notifications at github.com
Tue Mar 1 16:31:25 EST 2016


As `tie` copies references not objects you cannot return a tuple that is created from a `tie` using objects on stack.  However using `make_tuple` copies objects. Hence you return such tuples from functions. However you need to know the exact type of tuple. The type of RNN in the recurrent_network_test is:
RNN<
std::tuple<
          LinearLayer<arma::mat,arma::mat> &,
          RecurrentLayer<arma::mat,arma::mat> &,
          BaseLayer<LogisticFunction,arma::mat,arma::mat> &,
          LinearLayer<arma::mat,arma::mat> &,
         BaseLayer<LogisticFunction,arma::mat,arma::mat> &
         >,
 BinaryClassificationLayer,
RandomInitialization,
MeanSquaredErrorFunction
>
 If you are using C++14 though you can declare the return type as `auto`. Hence you could create a model 
`auto BuildNetwork(...) { return FNN(make_tuple(...),..) }`
In fact I wrote serialization code before I considered copy construction. But then I had to cut and paste code from the training module to the test module.




---
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/issues/531#issuecomment-190913778
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160301/489e627c/attachment.html>


More information about the mlpack-git mailing list