(self, original_node)
Replaces a Conv2D node with the eight bit equivalent sub-graph.
Replaces a Conv2D node with the eight bit equivalent sub-graph.
Replaces a Conv2D node with the eight bit equivalent sub - graph .
def eightbitize_conv_node(self, original_node):
    """Replaces a Conv2D node with the eight bit equivalent sub-graph."""
    all_input_names = self.add_eightbit_prologue_nodes(original_node)
    quantized_conv_name = original_node.name + "_eightbit_quantized_conv"
    quantized_conv_node = create_node("QuantizedConv2D", quantized_conv_name,
                                      all_input_names)
    copy_attr(quantized_conv_node, "strides", original_node.attr["strides"])
    copy_attr(quantized_conv_node, "padding", original_node.attr["padding"])
    set_attr_dtype(quantized_conv_node, "Tinput", dtypes.quint8)
    set_attr_dtype(quantized_conv_node, "Tfilter", dtypes.quint8)
    set_attr_dtype(quantized_conv_node, "out_type", dtypes.qint32)
    self.add_output_graph_node(quantized_conv_node)
    quantize_down_name = self.add_quantize_down_nodes(original_node,
                                                      quantized_conv_name)
    self.add_dequantize_result_node(quantize_down_name, original_node.name)
def eightbitize_conv_node ( self , original_node ) : all_input_names = self . add_eightbit_prologue_nodes ( original_node ) quantized_conv_name = original_node . name + "_eightbit_quantized_conv" quantized_conv_node = create_node ( "QuantizedConv2D" , quantized_conv_name , all_input_names ) copy_attr ( quantized_conv_node , "strides" , original_node . attr [ "strides" ] ) copy_attr ( quantized_conv_node , "padding" , original_node . attr [ "padding" ] ) set_attr_dtype ( quantized_conv_node , "Tinput" , dtypes . quint8 ) set_attr_dtype ( quantized_conv_node , "Tfilter" , dtypes . quint8 ) set_attr_dtype ( quantized_conv_node , "out_type" , dtypes . qint32 ) self . add_output_graph_node ( quantized_conv_node ) quantize_down_name = self . add_quantize_down_nodes ( original_node , quantized_conv_name ) self . add_dequantize_result_node ( quantize_down_name , original_node . name )