当TensorFlow找不到工具属性时,如何检查TensorFlow中检查点文件中的变量? [英] How does one inspect variables in a checkpoint file in TensorFlow when TensorFlow can't find the tools attribute?

查看:54
本文介绍了当TensorFlow找不到工具属性时,如何检查TensorFlow中检查点文件中的变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用 inspect_checkpoint.py .但是,我无法使它工作,因为他们没有真正提供示例.我尝试了我认为可行的最简单的方法:

I was trying to inspect checkpoints using the code at inspect_checkpoint.py. However, I wasn't able to have it work because they didn't really provide an example. I tried the simplest thing I thought would work:

tf.python.tools.inspect_checkpoint.print_tensors_in_checkpoint_file(file_name='./tmp/mdl_ckpt',tensor_name='',all_tensors='')

但是我发现python没有属性tools:

AttributeError: module 'tensorflow.python' has no attribute 'tools'

这似乎是一个(令人尴尬的)琐碎的错误/问题.有人知道发生了什么吗?为什么找不到工具?另外,即使找到了它,也将如何运行该文件中提供的功能?

it seems like a (embarrassingly) trivial bug/issue. Does someone know what is going on? Why can't it find tools? Also, even if it did find it, how would one run the function provided in that file?

不幸的是,这个非常相关的问题并未真正提供如何解决此问题的答案.问题在这里如何找到变量名保存在张量流检查点中的

Unfortunately, the very related question did not really provide an answer of how to get around this issue. The question is here How can find the variable names that saved in tensorflow checkpoint?

推荐答案

尝试一下:

from tensorflow.python.tools.inspect_checkpoint import print_tensors_in_checkpoint_file
print_tensors_in_checkpoint_file(file_name='./tmp/mdl_ckpt', tensor_name='', all_tensors=False)

添加了all_tensors参数是因为 Tensorflow 0.12.0-rc0 a>.

The all_tensors argument was added since Tensorflow 0.12.0-rc0.

这篇关于当TensorFlow找不到工具属性时,如何检查TensorFlow中检查点文件中的变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆