TensorFlow 输出checkpoint 中的变量名与变量值

xiaoxiao2021-02-28  20

import os from tensorflow.python import pywrap_tensorflow model_dir="/xxxxxxxxx/model.ckpt" #checkpoint的文件位置 # Read data from checkpoint file reader = pywrap_tensorflow.NewCheckpointReader(model_dir) var_to_shape_map = reader.get_variable_to_shape_map() # Print tensor name and values for key in var_to_shape_map: print("tensor_name: ", key) #输出变量名 print(reader.get_tensor(key)) #输出变量值

输出结果: 这里只输出了变量名
转载请注明原文地址: https://www.6miu.com/read-2250138.html

最新回复(0)