class_docstr: Testing usage of quantization ranges inserted in graph.
class_docstr_tok: ["Testing","usage","of","quantization","ranges","inserted","in","graph","."]
code: def _BuildGraph(self, x):
      def _Quantize(x, r):
          x = gen_array_ops.quantize_and_dequantize_v2(x, -r, r)
          return x
  
      def _DenseLayer(
          x, num_inputs, num_outputs, quantization_range, name
      ):
          """Defines a dense layer with quantized outputs.
  
          Args:
            x: input to the dense layer
            num_inputs: number of input columns of x
            num_outputs: number of output columns
            quantization_range: the min/max range for quantization
            name: name of the variable scope
  
          Returns:
            The output of the layer.
          """
          with variable_scope.variable_scope(name):
              kernel = variable_scope.get_variable(
                  "kernel",
                  shape=[num_inputs, num_outputs],
                  dtype=dtypes.float32,
                  initializer=init_ops.GlorotUniform(),
              )
              bias = variable_scope.get_variable(
                  "bias",
                  shape=[num_outputs],
                  dtype=dtypes.float32,
                  initializer=init_ops.Zeros(),
              )
              x = math_ops.matmul(x, kernel)
              x = _Quantize(x, quantization_range)
              x = nn.bias_add(x, bias)
              x = _Quantize(x, quantization_range)
          return x
  
      x = _Quantize(x, 1)
      # Conv + Bias + Relu6
      x = layers.conv2d(x, filters=32, kernel_size=3, use_bias=True)
      x = nn.relu6(x)
      # Conv + Bias + Relu6
      x = layers.conv2d(x, filters=64, kernel_size=3, use_bias=True)
      x = nn.relu6(x)
      # Reduce
      x = math_ops.reduce_mean(x, [1, 2])
      x = _Quantize(x, 6)
      # FC1
      x = _DenseLayer(x, 64, 512, 6, name="dense")
      x = nn.relu6(x)
      # FC2
      x = _DenseLayer(x, 512, 10, 25, name="dense_1")
      x = array_ops.identity(x, name=OUTPUT_NODE_NAME)
      return x
  
imports: import os.path
  import tempfile
  import tensorflow_datasets
  from tensorflow.compiler.tf2tensorrt._pywrap_py_utils import is_tensorrt_enabled
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.python.client import session
  from tensorflow.python.compiler.tensorrt import trt_convert
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.estimator.estimator import Estimator
  from tensorflow.python.estimator.model_fn import EstimatorSpec
  from tensorflow.python.estimator.model_fn import ModeKeys
  from tensorflow.python.estimator.run_config import RunConfig
  from tensorflow.python.framework import convert_to_constants
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import importer
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.keras.metrics import Accuracy
  from tensorflow.python.layers import layers
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_array_ops
  from tensorflow.python.ops import init_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import metrics
  from tensorflow.python.ops import nn
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.ops.losses import losses
  from tensorflow.python.platform import test
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.saved_model import builder
  from tensorflow.python.saved_model import signature_constants
  from tensorflow.python.saved_model import tag_constants
  from tensorflow.python.saved_model import utils
  from tensorflow.python.saved_model import signature_def_utils
  from tensorflow.python.saved_model.load import load
  from tensorflow.python.summary import summary
  from tensorflow.python.training import saver
  from tensorflow.python.training.adam import AdamOptimizer
  from tensorflow.python.training.checkpoint_management import latest_checkpoint
  from tensorflow.python.training.training_util import get_global_step
label_desc: Use image node_id 1 for calling the QuantizationAwareTrainingMNISTTest obj's underlying member method code with example usage: obj._BuildGraph(x) and returns: x, x, x