import time
start = time.perf_counter()
main()
elapsed = time.perf_counter() - start
print('Elapsed %.3f seconds.' % elapsed)
How to print the execution time of the computation done in a tensorflow code?