(self,
               input_graph,
               mode,
               quantized_input_range,
               fallback_quantization_range=None)
Sets up the class to rewrite a float graph.

    Args:
      input_graph: A float graph to transform.
      mode: A string controlling how quantization is performed -
        round, quantize, eightbit, or weights.
      quantized_input_range: if set, assume the input is
        quantized and represents the range
        [quantized_input_range[0], quantized_input_range[1]]
      fallback_quantization_range: if set, then for nodes where the quantization
        range can't be inferred from the graph, use the range
        [fallback_quantization_range[0], fallback_quantization_range[1]) instead
        of using a RequantizationRange node in the graph.

    Raises:
      ValueError: Two nodes with the same name were found in the graph.
Sets up the class to rewrite a float graph.
Sets up the class to rewrite a float graph .
def __init__(self,
               input_graph,
               mode,
               quantized_input_range,
               fallback_quantization_range=None):
    """Sets up the class to rewrite a float graph.

    Args:
      input_graph: A float graph to transform.
      mode: A string controlling how quantization is performed -
        round, quantize, eightbit, or weights.
      quantized_input_range: if set, assume the input is
        quantized and represents the range
        [quantized_input_range[0], quantized_input_range[1]]
      fallback_quantization_range: if set, then for nodes where the quantization
        range can't be inferred from the graph, use the range
        [fallback_quantization_range[0], fallback_quantization_range[1]) instead
        of using a RequantizationRange node in the graph.

    Raises:
      ValueError: Two nodes with the same name were found in the graph.
    """
    self.input_graph = input_graph
    self.nodes_map = self.create_nodes_map(input_graph)
    self.output_graph = None
    self.mode = mode
    self.final_node_renames = {}
    if quantized_input_range:
      self.input_range = (quantized_input_range[0], quantized_input_range[1])
      if self.input_range[0] >= self.input_range[1]:
        raise ValueError("Invalid quantized_input_range: [%s,%s]" %
                         self.input_range)
      if self.mode != "eightbit":
        raise ValueError(
            "quantized_input_range can only be specified in eightbit mode")
    else:
      self.input_range = None

    if fallback_quantization_range:
      self.fallback_quantization_range = [
          fallback_quantization_range[0], fallback_quantization_range[1]
      ]
      if (self.fallback_quantization_range[0] >=
          self.fallback_quantization_range[1]):
        raise ValueError("Invalid fallback_quantization_range: [%s,%s]" %
                         self.fallback_quantization_range)
      if self.mode != "eightbit":
        raise ValueError("fallback_quantization_range can only be "
                         "specified in eightbit mode")
    else:
      self.fallback_quantization_range = None

    # Data that is valid only during the recursive call to rewrite the graph.
    self.state = None
def __init__ ( self , input_graph , mode , quantized_input_range , fallback_quantization_range = None ) : self . input_graph = input_graph self . nodes_map = self . create_nodes_map ( input_graph ) self . output_graph = None self . mode = mode self . final_node_renames = { } if quantized_input_range : self . input_range = ( quantized_input_range [ 0 ] , quantized_input_range [ 1 ] ) if self . input_range [ 0 ] >= self . input_range [ 1 ] : raise ValueError ( "Invalid quantized_input_range: [%s,%s]" % self . input_range ) if self . mode != "eightbit" : raise ValueError ( "quantized_input_range can only be specified in eightbit mode" ) else : self . input_range = None if fallback_quantization_range : self . fallback_quantization_range = [ fallback_quantization_range [ 0 ] , fallback_quantization_range [ 1 ] ] if ( self . fallback_quantization_range [ 0 ] >= self . fallback_quantization_range [ 1 ] ) : raise ValueError ( "Invalid fallback_quantization_range: [%s,%s]" % self . fallback_quantization_range ) if self . mode != "eightbit" : raise ValueError ( "fallback_quantization_range can only be " "specified in eightbit mode" ) else : self . fallback_quantization_range = None # Data that is valid only during the recursive call to rewrite the graph. self . state = None