import time


def seconds_per_run(op, sess, num_runs=50):
  """Number of seconds taken to execute 'op' once on average."""
  for _ in range(2):
    sess.run(op)

  start_time = time.time()
  for _ in range(num_runs):
    sess.run(op)

  end_time = time.time()
  time_taken = (end_time - start_time) / num_runs
  return time_taken