class_docstr: Benchmark batch normalization.
docstr: Run the graph and print its execution time.
  
  Args:
    device: string, the device to run on.
    input_shape: shape of the input tensor.
    axes: axes that are to be normalized across.
    num_layers: number of batch normalization layers in the graph.
    mode: "op", "py" or "slow" depending on the implementation.
    scale: scale after normalization.
    train: if true, also run backprop.
    num_iters: number of steps to run.
  
  Returns:
    The duration of the run in seconds.
docstr_tok: ["Run","the","graph","and","print","its","execution","time",".","Args",":","device",":","string",",","the","device","to","run","on",".","input_shape",":","shape","of","the","input","tensor",".","axes",":","axes","that","are","to","be","normalized","across",".","num_layers",":","number","of","batch","normalization","layers","in","the","graph",".","mode",":","``","op","''",",","``","py","''","or","``","slow","''","depending","on","the","implementation",".","scale",":","scale","after","normalization",".","train",":","if","true",",","also","run","backprop",".","num_iters",":","number","of","steps","to","run",".","Returns",":","The","duration","of","the","run","in","seconds","."]
code: def _run_graph(
      self,
      device,
      input_shape,
      axes,
      num_layers,
      mode,
      scale,
      train,
      num_iters,
  ):
      """Run the graph and print its execution time.
  
      Args:
        device: string, the device to run on.
        input_shape: shape of the input tensor.
        axes: axes that are to be normalized across.
        num_layers: number of batch normalization layers in the graph.
        mode: "op", "py" or "slow" depending on the implementation.
        scale: scale after normalization.
        train: if true, also run backprop.
        num_iters: number of steps to run.
  
      Returns:
        The duration of the run in seconds.
      """
      graph = ops.Graph()
      with graph.as_default():
          outputs = build_graph(
              device, input_shape, axes, num_layers, mode, scale, train
          )
      with session_lib.Session(graph=graph) as session:
          variables.global_variables_initializer().run()
          _ = session.run([out.op for out in outputs])  # warm up.
          start_time = time.time()
          for _ in range(num_iters):
              _ = session.run([out.op for out in outputs])
          duration = time.time() - start_time
      print(
          "%s shape:%d/%d #layers:%d mode:%s scale:%r train:%r - %f secs"
          % (
              device,
              len(input_shape),
              len(axes),
              num_layers,
              mode,
              scale,
              train,
              duration / num_iters,
          )
      )
  
      name_template = (
          "batch_norm_{device}_input_shape_{shape}_axes_{axes}_mode_{mode}_"
          "layers_{num_layers}_scale_{scale}_"
          "train_{train}"
      )
  
      self.report_benchmark(
          name=name_template.format(
              device=device,
              mode=mode,
              num_layers=num_layers,
              scale=scale,
              train=train,
              shape=str(input_shape).replace(" ", ""),
              axes=str(axes),
          ).replace(" ", ""),
          iters=num_iters,
          wall_time=duration / num_iters,
      )
  
      return duration
  
imports: import argparse
  import sys
  import time
  from tensorflow.python.client import session
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_nn_ops
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_impl
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import variables
  import tensorflow.python.ops.nn_grad
  from tensorflow.python.platform import test
label_desc: Use image node_id 1 for calling the BatchNormBenchmark obj's underlying member method code with example usage: obj._run_graph(device, input_shape, axes, num_layers, mode, scale, train, num_iters) and returns: duration