mlR*_*cks 3 machine-learning neural-network deep-learning conv-neural-network tensorflow
我正在张量流中训练模型,并且正在为模型做检查点。在Checkpoints目录中,我有四个文件,
checkpointmodel.cpkt-0.data-00000-of-00001model.cpkt-0.indexmodel.cpkt-0.meta现在,我要提取图形中每一层的权重值,该怎么做?
我尝试了这个:
import tensorflow as tf
sess = tf.InteractiveSession()
saver = tf.train.import_meta_graph('model.cpkt-0.meta')
w = saver.restore(sess, 'model.cpkt-0.data-00000-of-00001')
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
Unable to open table file ./model.cpkt-0.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?
Run Code Online (Sandbox Code Playgroud)
您的恢复方式有误
saver.restore(sess, 'model.cpkt-0')
# get the graph
g = tf.get_default_graph()
w1 = g.get_tensor_by_name('some_variable_name as per your definition in the model')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2029 次 |
| 最近记录: |