<p>Thank you both for your replies. </p>

<blockquote>
<p>"if using an mlpack command-line program, the type should be handled for the user; if using the mlpack C++ code, then the user is responsible for serializing and deserializing the correct type"</p>
</blockquote>

<p>Moving forward, I see myself using the mlpack C++ code a lot more than the command line version, so I guess I need to care of serializing and deserializing this. The main problem in the current code is for every prediction I need to call "BuildFNN" which ends up training the network again and again. That is why I thought I could just return the trained network from where its being called and do prediction later but the I think the data gets corrupted on return and the prediction call segfaults. </p>

<blockquote>
<p>You need to remember what kind of network you build, Following part are the "type" of network of yours</p>
</blockquote>

<p>As you can see in that code decltype(modules) and decltype(classOutputLayer) determines the type of the network at compile time. I understand I pass the types on my call and I can get the classOuputLayer type pretty easily which is the BinaryClassification layer. However, the first type which is the layertypes is a std::tie (which I'm fairly new to) which returns a tuple of the input-hidden layers. I'm not sure what this returns to create a network of the appropriate type. If I can get some help on that, it'll be great!</p>

<p>Thanks.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/issues/531#issuecomment-190796758">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFKUMVenF_hOxA793opChgAYd3L96ks5ppGm2gaJpZM4HmbCC.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/mlpack/mlpack/issues/531#issuecomment-190796758"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>