【tensorflow】【python】Tensor Check Solution

  • Post author:
  • Post category:python


2020年2月12日 0次阅读 共721个字 0条评论 0人点赞 QueenDekimZ

Tensor Check

################

#This code used to check msg of Tensor stored in ckpt

#work well with tensorflow version of ‘v1.3.0-rc2-20-g0787eee’

################

import os

from tensorflow.python import pywrap_tensorflow

#code for finall ckpt

#checkpoint_path = os.path.join(’~/tensorflowTraining/ResNet/model’, “model.ckpt”)

#code for designated ckpt, change 3890 to your num

checkpoint_path = os.path.join(‘F:/Coding_Tools/coding_test_file/20180402-114759’, “model-20180402-114759.ckpt-275”)

#Read data from checkpoint file

reader = pywrap_tensorflow.NewCheckpointReader(checkpoint_path)

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))



版权声明:本文为qq_40905896原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。