首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >比较tensorflow variables.index和variables.data文件

比较tensorflow variables.index和variables.data文件
EN

Stack Overflow用户
提问于 2019-01-29 16:20:16
回答 1查看 966关注 0票数 3

如何比较两组TensorFlow文件variables.indexvariables.data-00000-of-00001?有什么实用工具可以让我用纯文本读取它们,或者用其他方式比较这些文件中的值吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-29 16:40:02

为了查看存储在文件中的张量,只需执行以下操作:

代码语言:javascript
复制
from tensorflow.python.tools.inspect_checkpoint import print_tensors_in_checkpoint_file

print_tensors_in_checkpoint_file(file_name="model_name",tensor_name="",all_tensors=True)

输出将类似于:

代码语言:javascript
复制
tensor_name:  Decoder/decoder/Attention_Wrapper/attention_layer/kernel
[[-0.24866164 -0.0762616   0.02982535 ...  0.14274237 -0.0651149
   0.18989304]
 [ 0.16675466  0.01662545  0.00896074 ... -0.06836775 -0.02540337
   0.0579135 ]
 [-0.34853792  0.05886076  0.21691915 ...  0.03068756  0.37517232
   0.0330036 ]
 ...
 [-0.00463026 -0.05060914 -0.03661629 ...  0.03341271 -0.003078
   0.04194186]
 [ 0.07343228 -0.00445814 -0.01558546 ... -0.0164716  -0.00453405
   0.0168137 ]
 [ 0.03857246 -0.04361508 -0.04800353 ...  0.06200589 -0.05994397
  -0.03183305]]
tensor_name:  Decoder/decoder/Attention_Wrapper/attention_layer/kernel/training_op
[[1.7215452e-08 1.6511342e-08 2.3156689e-08 ... 6.9746142e-09
  3.6705597e-08 6.0520193e-09]
 [2.8541326e-06 9.9242357e-07 4.3421019e-07 ... 8.2636637e-07
  2.9466917e-06 9.2266538e-07]
 [1.4949121e-06 4.0124786e-07 1.8415257e-07 ... 2.1582312e-07
  6.7197351e-07 3.1459973e-07]
 ...
 [3.6029601e-15 1.2615142e-15 4.7981583e-15 ... 5.8665957e-16
  2.0862790e-15 2.4295565e-15]
 [5.8586951e-14 4.5164783e-14 2.6819809e-14 ... 4.2972126e-14
  1.1934837e-13 3.0617263e-14]
 [2.6801797e-15 9.8903675e-16 3.7704488e-16 ... 9.2021988e-16
  2.9194079e-15 9.9945483e-16]]
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54425379

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档