Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save weights of training data from MNIST testing on tensorflow for future use?

I am facing problems with saving the training weight (W) for MNIST tensorflow example as described here. MNIST tensorflow. If my understanding is correct, we need the training weight in future for other testing cases (not the MNIST testing case). I tried print W.eval() to get the weight; but it happens to provide me with a zero matrix of 784x10. How can I get the weights in an array form or in .csv format (not .cpkt)?

like image 935
Nasiba Avatar asked Oct 18 '22 13:10

Nasiba


1 Answers

I've done something similar like so:

weight_values = session.run(W)
numpy.savetxt("myfilename.csv", weight_values, delimiter=",")
like image 176
Daniel Slater Avatar answered Nov 01 '22 15:11

Daniel Slater