Skip to content

Instantly share code, notes, and snippets.

@kretes
Created May 12, 2021 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kretes/408aa8831b6d37ff24df21e5c36fd91c to your computer and use it in GitHub Desktop.
Save kretes/408aa8831b6d37ff24df21e5c36fd91c to your computer and use it in GitHub Desktop.
function wrapper to measure execution time in tf graph
def measure_time_tf(fun, name):
def time_measuring(*args):
start = tf.timestamp()
result = fun(*args)
end = tf.timestamp()
diff_times100 = 100.0 * (end - start)
tf.print(name, tf.cast(tf.cast(diff_times100, tf.int32), tf.float32) / 100.0)
return result
return time_measuring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment