急切模式是否支持r1.8中的tf.profiler
?由于它不再具有会话对象,有没有办法将tf.RunMetadata()
传入执行中?我看到探查器构造函数检查了急切模式;但如果没有RunMetadata
,它就无法运作。谢谢!
答案 0 :(得分:-2)
with context.eager_mode():
outfile = os.path.join(test.get_temp_dir(), 'dump')
opts = builder(
builder.time_and_memory()).with_file_output(outfile).build()
context.enable_run_metadata()
# run your model here #
profiler = model_analyzer.Profiler()
profiler.add_step(0, context.export_run_metadata())
context.disable_run_metadata()
profiler.profile_operations(opts)
您可以参考以下链接(testEager函数)。 https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/profiler/model_analyzer_test.py