Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Hanxi_F_
Beginner
71 Views

Get trained model by neural network

Hi,

Is there any method to get the trained model parameters. For example, the weight dataset of each layers? Is that possible?

I do not want to train the model repeatedly.

Thanks a lot!!!

0 Kudos
3 Replies
71 Views

Hello Hanxi,

There are several possibilities to get the parameters of the trained model:

  • Directly from forward layers of neural network by using your_layer.input.get(layers::forward::weights) to get the weights for the forward layer as a Tensor and your_layer.input.get(layers::forward::biases) to get the biases respectively.
  • From an instance of neural_networks::training::Model.
    • To get weights and biases for the particular layer please use getWeightsAndBiases(layerId) method. It returns weights and biases for the layer packed into single numeric table.
    • To get weights and biases for the whole network please use getWeightsAndBiases() method.

​All the getters methods mentioned above have pair setters that are used for setting the pre-trained parameters to the model of neural network.

Please have a look at our neural_net_predict_dense_batch.cpp example to see how to perform neural networks prediction with the pre-trined parameters.

Best regards,

Victoriya

Hanxi_F_
Beginner
71 Views

Thanks Victoriya!

That's what I need!

BTW, I've looked up the manual and find it a little bit hard to get all the member functions I need.Is there any easy way to get them?

 

Thanks.

71 Views

Please have a look at Developer Guide and Reference for Intel® DAALIt contains the descriptions of all the Intel® DAAL classes and their members. For example, here is the description of neural_networks::training::Model class.

Best regards,

Victoriya

Reply