小編給大家分享一下Tensorflow 1.0之后模型文件、權(quán)重?cái)?shù)值如何讀取,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
保存的文件有4個(gè):
checkpoint
model-parameters.bin-46000.data-00000-of-00001
model-parameters.bin-46000.index
model-parameters.bin-46000.meta
讀取代碼:
from tensorflow.python import pywrap_tensorflow with tf.Graph().as_default(): with tf.Session() as sess: ckpt = tf.train.get_checkpoint_state('./checkpoint') if ckpt and ckpt.model_checkpoint_path: reader = pywrap_tensorflow.NewCheckpointReader('./checkpoint/model-parameters.bin-46000') all_variables = reader.get_variable_to_shape_map() w1 = reader.get_tensor("conv1/weight") print(w1.shape) print(w1) print(all_variables) else: print('No checkpoint file found')
以上是“Tensorflow 1.0之后模型文件、權(quán)重?cái)?shù)值如何讀取”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!