我正在查看tensorflow日志并发现以下行:
4 ops no flops stats due to incomplete shapes. Consider passing run_meta to use run_time shapes.
Run Code Online (Sandbox Code Playgroud)
此消息似乎来自以下代码:
4 ops no flops stats due to incomplete shapes. Consider passing run_meta to use run_time shapes.
Run Code Online (Sandbox Code Playgroud)
在与GRU类似的情况下,日志中的此行不会出现。因此,我认为错误不是由批量大小引起的。你能解释一下这是什么吗?另外,如何添加“ run_meta”属性?谢谢。
'...由于形状不完整而没有 flops stats' 意味着您对某些变量有未知的 [形状] 信息,例如,当您处理可变批量大小([无] 形状)或任意时间量的 tf.while_loop 等时.
根据官方tfprof文档(来源):
- 它必须知道 RegisterStatistics('flops') 的“形状”信息才能计算统计信息。
-run_meta_path如果形状仅在运行时已知,则建议传入。tfprof 可以使用 RunMetadata 中的运行时形状信息填充缺失的形状。
至于 RunMetadata,tensorflow 中有一个tf.RunMetadata()op,应该就是你需要的。通常你将它传递给一个sess.run()操作。
对此的解决方案是在运行时传递 RunMetadata,届时将定义所有形状。
# Generate the RunMetadata that contains the memory and timing information.
#
# Note: When run on GPU, a kernel is first scheduled (enqueued) and then
# executed asynchronously. tfprof only tracks the execution time.
#
run_metadata = tf.RunMetadata()
with tf.Session() as sess:
_ = sess.run(train_op,
options=tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE),
run_metadata=run_metadata)
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助。
| 归档时间: |
|
| 查看次数: |
4213 次 |
| 最近记录: |