??如何查看ckpt文件中的內容
來自專欄 TensorFlow
import osfrom tensorflow.python import pywrap_tensorflowcheckpoint_path = /Users/andy/Desktop/fcn-optimized-version/save/model.ckpt-900保存的文件有三個:1??checkpoint2??model.ckpt-900.data-00000-of-000013??model.ckpt-900.index??在設置checkpoint_path的時候,文件名為model.ckpt-900reader = pywrap_tensorflow.NewCheckpointReader(checkpoint_path)#print(dir(reader))#get_tensor, get_variable_to_shape_map, has_tensor, this#print(reader.this)#<Swig Object of type tensorflow::checkpoint::CheckpointReader * at 0x1132b1a80>#print(reader.has_tensor(Variable_16))#Trueparam_dict = reader.get_variable_to_shape_map()print(type(param_dict))#<class dict>for key in param_dict: print("tensor_name: ", key)#tensor的名字 print(reader.get_tensor(key))#tensor的具體值
推薦閱讀:
※一文弄清深度學習、TensorFlow和張量之間的關係
※第五步 tensorflow模型的運行機制
※安裝cuda9失敗?
※基於TensorFlow構建圖片風格遷移模型
※tensorflow保存和恢復模型的兩種方法介紹
TAG:科技 | TensorFlow |