parameters: (self, launch_test, test_case, iters, print_per_iter)
return_statement: return reported_run_time_us
docstring: This function execute the operator for <iters> iterations then look at the time.
          If it's not significant, the number of iterations will be increased before rerun.
          The execution stops when the time becomes significant.
docstring_summary: This function execute the operator for <iters> iterations then look at the time.
          If it's not significant, the number of iterations will be increased before rerun.
          The execution stops when the time becomes significant.
docstring_tokens: This function execute the operator for <iters > iterations then look at the time . If it s not significant the number of iterations will be increased before rerun . The execution stops when the time becomes significant .
function: def _measure_time(self, launch_test, test_case, iters, print_per_iter):
          """
          This function execute the operator for <iters> iterations then look at the time.
          If it's not significant, the number of iterations will be increased before rerun.
          The execution stops when the time becomes significant.
          """
          curr_test_total_time = 0
          time_trace = []
          while True:
              run_time_sec = launch_test(test_case, iters, print_per_iter)
              curr_test_total_time += run_time_sec
              # Analyze time after each run to decide if the result is stable
              results_are_significant = self._iteration_result_is_significant(
                  iters, run_time_sec, curr_test_total_time, self.has_explicit_iteration_count)
  
              report_run_time = 1e6 * run_time_sec / iters
              time_trace.append(report_run_time)
              # Print out the time spent in each epoch in ms
              if self.args.ai_pep_format:
                  mode = "JIT" if self.use_jit else "Eager"
                  test_name = '_'.join([test_case.framework, test_case.test_config.test_name, mode])
                  print("PyTorchObserver " + json.dumps(
                      {
                          "type": test_name,
                          "metric": "latency",
                          "unit": "ms",
                          "value": str(report_run_time / 1e3),
                      }
                  ))
              if results_are_significant:
                  break
  
              # Re-estimate the hopefully-sufficient
              # iteration count, and run the benchmark again...
              iters = self._predict_num_iter_needed(iters)
          reported_run_time_us = np.percentile(np.array(time_trace), 50)
          return reported_run_time_us
function_tokens: def _measure_time ( self , launch_test , test_case , iters , print_per_iter ) : curr_test_total_time = 0 time_trace = [ ] while True : run_time_sec = launch_test ( test_case , iters , print_per_iter ) curr_test_total_time += run_time_sec # Analyze time after each run to decide if the result is stable results_are_significant = self . _iteration_result_is_significant ( iters , run_time_sec , curr_test_total_time , self . has_explicit_iteration_count ) report_run_time = 1e6 * run_time_sec / iters time_trace . append ( report_run_time ) # Print out the time spent in each epoch in ms if self . args . ai_pep_format : mode = "JIT" if self . use_jit else "Eager" test_name = '_' . join ( [ test_case . framework , test_case . test_config . test_name , mode ] ) print ( "PyTorchObserver " + json . dumps ( { "type" : test_name , "metric" : "latency" , "unit" : "ms" , "value" : str ( report_run_time / 1e3 ) , } ) ) if results_are_significant : break # Re-estimate the hopefully-sufficient # iteration count, and run the benchmark again... iters = self . _predict_num_iter_needed ( iters ) reported_run_time_us = np . percentile ( np . array ( time_trace ) , 50 ) return reported_run_time_us