code: def testFoldFusedBatchNorms(self):
      for data_format, use_gpu, conv2d_func in [
          ("NHWC", False, nn_ops.conv2d),
          ("NCHW", True, nn_ops.conv2d),
          ("NHWC", False, nn_ops.depthwise_conv2d_native),
          ("NCHW", True, nn_ops.depthwise_conv2d_native),
      ]:
          with self.cached_session(use_gpu=use_gpu) as sess:
              inputs = [1, 4, 2, 5, 3, 6, -1, -4, -2, -5, -3, -6]
              input_op = constant_op.constant(
                  np.array(inputs),
                  shape=[1, 1, 6, 2]
                  if data_format == "NHWC"
                  else [1, 2, 1, 6],
                  dtype=dtypes.float32,
              )
              if conv2d_func == nn_ops.conv2d:
                  weights = [1, 2, 3, 4, 0.1, 0.2, 0.3, 0.4]
                  weights_op = constant_op.constant(
                      np.array(weights),
                      shape=[1, 2, 2, 2],
                      dtype=dtypes.float32,
                  )
              else:
                  weights = [1, 2, 0.3, 0.4]
                  weights_op = constant_op.constant(
                      np.array(weights),
                      shape=[1, 2, 2, 1],
                      dtype=dtypes.float32,
                  )
              conv_op = conv2d_func(
                  input_op,
                  weights_op,
                  [1, 1, 1, 1],
                  padding="SAME",
                  data_format=data_format,
                  name="conv_op",
              )
              mean_op = constant_op.constant(
                  np.array([10, 20]), shape=[2], dtype=dtypes.float32
              )
              variance_op = constant_op.constant(
                  np.array([0.25, 0.5]), shape=[2], dtype=dtypes.float32
              )
              beta_op = constant_op.constant(
                  np.array([0.1, 0.6]), shape=[2], dtype=dtypes.float32
              )
              gamma_op = constant_op.constant(
                  np.array([1.0, 2.0]), shape=[2], dtype=dtypes.float32
              )
              ops.get_default_graph().graph_def_versions.producer = 9
              gen_nn_ops._fused_batch_norm(
                  conv_op,
                  gamma_op,
                  beta_op,
                  mean_op,
                  variance_op,
                  0.00001,
                  is_training=False,
                  data_format=data_format,
                  name="output",
              )
              original_graph_def = sess.graph_def
              original_result = sess.run(["output:0"])
          optimized_graph_def = (
              optimize_for_inference_lib.fold_batch_norms(
                  original_graph_def
              )
          )
  
          _ = importer.import_graph_def(
              optimized_graph_def, input_map={}, name="optimized"
          )
          optimized_result = sess.run(["optimized/output:0"])
  
          self.assertAllClose(
              original_result, optimized_result, rtol=1e-04, atol=1e-06
          )
  
          for node in optimized_graph_def.node:
              self.assertNotEqual("FusedBatchNorm", node.op)
  
imports: import numpy
  from tensorflow.core.framework import attr_value_pb2
  from tensorflow.core.framework import graph_pb2
  from tensorflow.core.framework import node_def_pb2
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import importer
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_util
  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 image_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.platform import test
  from tensorflow.python.tools import optimize_for_inference_lib
label_desc: Use image node_id 11 for calling the OptimizeForInferenceTest obj's underlying member method code with example usage: obj.testFoldFusedBatchNorms() without return types