(self, namespace_prefix, original_input_name,
                                reshape_dims_name, reduction_dims_name)
return quantize_input_name, min_output_name, max_output_name
Takes one float input to an op, and converts it to quantized form.
Takes one float input to an op, and converts it to quantized form.
Takes one float input to an op and converts it to quantized form .
def eightbitize_input_to_node(self, namespace_prefix, original_input_name,
                                reshape_dims_name, reduction_dims_name):
    """Takes one float input to an op, and converts it to quantized form."""
    unique_input_name = unique_node_name_from_input(original_input_name)
    reshape_input_name = namespace_prefix + "_reshape_" + unique_input_name
    min_input_name = namespace_prefix + "_min_" + unique_input_name
    max_input_name = namespace_prefix + "_max_" + unique_input_name
    quantize_input_name = namespace_prefix + "_quantize_" + unique_input_name
    reshape_input_node = create_node("Reshape", reshape_input_name,
                                     [original_input_name, reshape_dims_name])
    set_attr_dtype(reshape_input_node, "T", dtypes.float32)
    self.add_output_graph_node(reshape_input_node)
    min_input_node = create_node("Min", min_input_name,
                                 [reshape_input_name, reduction_dims_name])
    set_attr_dtype(min_input_node, "T", dtypes.float32)
    set_attr_bool(min_input_node, "keep_dims", False)
    self.add_output_graph_node(min_input_node)
    max_input_node = create_node("Max", max_input_name,
                                 [reshape_input_name, reduction_dims_name])
    set_attr_dtype(max_input_node, "T", dtypes.float32)
    set_attr_bool(max_input_node, "keep_dims", False)
    self.add_output_graph_node(max_input_node)
    quantize_input_node = create_node(
        "QuantizeV2", quantize_input_name,
        [original_input_name, min_input_name, max_input_name])
    set_attr_dtype(quantize_input_node, "T", dtypes.quint8)
    set_attr_string(quantize_input_node, "mode", b"MIN_FIRST")
    self.add_output_graph_node(quantize_input_node)
    min_output_name = quantize_input_name + ":1"
    max_output_name = quantize_input_name + ":2"
    return quantize_input_name, min_output_name, max_output_name
def eightbitize_input_to_node ( self , namespace_prefix , original_input_name , reshape_dims_name , reduction_dims_name ) : unique_input_name = unique_node_name_from_input ( original_input_name ) reshape_input_name = namespace_prefix + "_reshape_" + unique_input_name min_input_name = namespace_prefix + "_min_" + unique_input_name max_input_name = namespace_prefix + "_max_" + unique_input_name quantize_input_name = namespace_prefix + "_quantize_" + unique_input_name reshape_input_node = create_node ( "Reshape" , reshape_input_name , [ original_input_name , reshape_dims_name ] ) set_attr_dtype ( reshape_input_node , "T" , dtypes . float32 ) self . add_output_graph_node ( reshape_input_node ) min_input_node = create_node ( "Min" , min_input_name , [ reshape_input_name , reduction_dims_name ] ) set_attr_dtype ( min_input_node , "T" , dtypes . float32 ) set_attr_bool ( min_input_node , "keep_dims" , False ) self . add_output_graph_node ( min_input_node ) max_input_node = create_node ( "Max" , max_input_name , [ reshape_input_name , reduction_dims_name ] ) set_attr_dtype ( max_input_node , "T" , dtypes . float32 ) set_attr_bool ( max_input_node , "keep_dims" , False ) self . add_output_graph_node ( max_input_node ) quantize_input_node = create_node ( "QuantizeV2" , quantize_input_name , [ original_input_name , min_input_name , max_input_name ] ) set_attr_dtype ( quantize_input_node , "T" , dtypes . quint8 ) set_attr_string ( quantize_input_node , "mode" , b"MIN_FIRST" ) self . add_output_graph_node ( quantize_input_node ) min_output_name = quantize_input_name + ":1" max_output_name = quantize_input_name + ":2" return quantize_input_name , min_output_name , max_output_name