class_docstr: Benchmark transpose!
class_docstr_tok: ["Benchmark","transpose","!"]
docstr: runs the graph and print its execution time.
  
  Args:
    device: String, the device to run on.
    input_shape: Shape of the input tensor.
    perm: A list of ints with the same length as input tensor's dimension.
    num_iters: Number of iterations to run the benchmark.
    datatype: numpy data type of the input tensor.
  
  Returns:
    The duration of the run in seconds.
docstr_tok: ["runs","the","graph","and","print","its","execution","time",".","Args",":","device",":","String",",","the","device","to","run","on",".","input_shape",":","Shape","of","the","input","tensor",".","perm",":","A","list","of","ints","with","the","same","length","as","input","tensor","'s","dimension",".","num_iters",":","Number","of","iterations","to","run","the","benchmark",".","datatype",":","numpy","data","type","of","the","input","tensor",".","Returns",":","The","duration","of","the","run","in","seconds","."]
code: def _run_graph(self, device, input_shape, perm, num_iters, datatype):
      """runs the graph and print its execution time.
  
      Args:
        device: String, the device to run on.
        input_shape: Shape of the input tensor.
        perm: A list of ints with the same length as input tensor's dimension.
        num_iters: Number of iterations to run the benchmark.
        datatype: numpy data type of the input tensor.
  
      Returns:
        The duration of the run in seconds.
      """
      graph = ops.Graph()
      with graph.as_default():
          outputs = build_graph(
              device, input_shape, perm, datatype, num_iters
          )
          with session_lib.Session(graph=graph) as session:
              variables.global_variables_initializer().run()
              # warmup runs
              session.run(outputs)
              start_time = time.time()
              session.run(outputs)
  
              duration = (time.time() - start_time) / num_iters
              throughput = (
                  np.prod(np.array(input_shape))
                  * datatype().itemsize
                  * 2
                  / duration
                  / 1e9
              )
  
              print(
                  "%s %s inputshape:%s perm:%s %d %.6fsec, %.4fGB/s."
                  % (
                      device,
                      str(datatype),
                      str(input_shape).replace(" ", ""),
                      str(perm).replace(" ", ""),
                      num_iters,
                      duration,
                      throughput,
                  )
              )
  
      name_template = "transpose_{device}_{dtype}_input_shape_{inputshape}_perm_{perm}"
  
      self.report_benchmark(
          name=name_template.format(
              device=device,
              dtype=str(datatype).replace(" ", ""),
              inputshape=str(input_shape).replace(" ", ""),
              perm=str(perm).replace(" ", ""),
          ).replace(" ", ""),
          iters=num_iters,
          wall_time=duration,
      )
  
      return duration
  
file_path: tensorflow/tensorflow/python/ops/transpose_benchmark.py
imports: import time
  import numpy
  from tensorflow.python.client import session
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
label_desc: Use image node_id 1 for calling the TransposeBenchmark obj's underlying member method code with example usage: obj._run_graph(device, input_shape, perm, num_iters, datatype) and returns: duration