How can I profile graph functions in TensorFlow Eager?

Deadly 提交于 2019-12-11 05:14:23

问题


In TensorFlow Eager, I can use Python's profiler to profile code that operates purely in eager mode. However, if I "compile" a python function to a graph function using tf.function or tf.contrib.eager.defun, that function becomes opaque to python - the profiler cannot enter it.

I have found out how to profile a TF graph in graph mode, but I don't know how to do it with a graph function in eager mode.

Specifically, if I construct a function like this,

tf.enable_v2_behavior()

@tf.function
def myfunc(x):
  y = op1(x)
  z = op2(y, z)
  return z

how do I figure out how much time is spent in op1 and op2 when I execute myfunc?

来源:https://stackoverflow.com/questions/56693208/how-can-i-profile-graph-functions-in-tensorflow-eager

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!