(self, current_node)
Replaces a placeholder node with a quint8 placeholder node+dequantize.
Replaces a placeholder node with a quint8 placeholder node+dequantize.
Replaces a placeholder node with a quint8 placeholder node + dequantize .
def eightbitize_placeholder_node(self, current_node):
    """Replaces a placeholder node with a quint8 placeholder node+dequantize."""
    name = current_node.name

    # Convert the placeholder into a quantized type.
    output_node = node_def_pb2.NodeDef()
    output_node.CopyFrom(current_node)
    set_attr_dtype(output_node, "dtype", dtypes.quint8)
    output_node.name += "_original_input"
    self.add_output_graph_node(output_node)

    # Add a dequantize to convert back to float.
    dequantize_node = create_node("Dequantize", name, [
        output_node.name, "quantized_input_min_value",
        "quantized_input_max_value"
    ])
    set_attr_dtype(dequantize_node, "T", dtypes.quint8)
    set_attr_string(dequantize_node, "mode", b"MIN_FIRST")
    self.add_output_graph_node(dequantize_node)

    # For the descent over the graph to work, the dequantize node must be named
    # current_node.name.  However, for the feeding of the graph to work, the
    # placeholder must have the name current_node.name; so record a final set
    # of renames to apply after all processing has been done.
    self.final_node_renames[output_node.name] = name
    self.final_node_renames[dequantize_node.name] = name + "_dequantize"
def eightbitize_placeholder_node ( self , current_node ) : name = current_node . name # Convert the placeholder into a quantized type. output_node = node_def_pb2 . NodeDef ( ) output_node . CopyFrom ( current_node ) set_attr_dtype ( output_node , "dtype" , dtypes . quint8 ) output_node . name += "_original_input" self . add_output_graph_node ( output_node ) # Add a dequantize to convert back to float. dequantize_node = create_node ( "Dequantize" , name , [ output_node . name , "quantized_input_min_value" , "quantized_input_max_value" ] ) set_attr_dtype ( dequantize_node , "T" , dtypes . quint8 ) set_attr_string ( dequantize_node , "mode" , b"MIN_FIRST" ) self . add_output_graph_node ( dequantize_node ) # For the descent over the graph to work, the dequantize node must be named # current_node.name.  However, for the feeding of the graph to work, the # placeholder must have the name current_node.name; so record a final set # of renames to apply after all processing has been done. self . final_node_renames [ output_node . name ] = name self . final_node_renames [ dequantize_node . name ] = name + "_dequantize"