parameters: (self, graph)
return_statement: return graph
docstring: Convert weights' type of the graph. After that, the data type of the
          graph weights is int8_t.
  
          Args:
              graph(IrGraph): the applied graph.
          Returns:
              None
docstring_summary: Convert weights' type of the graph. After that, the data type of the
          graph weights is int8_t.
docstring_tokens: Convert weights type of the graph . After that the data type of the graph weights is int8_t .
function: def apply(self, graph):
          """
          Convert weights' type of the graph. After that, the data type of the
          graph weights is int8_t.
  
          Args:
              graph(IrGraph): the applied graph.
          Returns:
              None
          """
          persistable_vars = [p.name() for p in graph.all_persistable_nodes()]
          ops = graph.all_op_nodes()
          input_map = {}
          for op_node in ops:
              if op_node.op().has_attr("quantization_type") and \
                  op_node.op().attr("quantization_type") == "qat_with_weight":
                  for var_node in op_node.inputs:
                      name = var_node.name()
                      if name in persistable_vars:
                          if name not in input_map:
                              int8_var_node = self._convert_to_int8(graph,
                                                                    var_node)
                              input_map[name] = int8_var_node
                          graph.update_input_link(var_node, input_map[name],
                                                  op_node)
  
          # remove the unused var node in the graph
          self._remove_unused_var_nodes(graph)
          graph.resolve_hazard()
          return graph
function_tokens: def apply ( self , graph ) : persistable_vars = [ p . name ( ) for p in graph . all_persistable_nodes ( ) ] ops = graph . all_op_nodes ( ) input_map = { } for op_node in ops : if op_node . op ( ) . has_attr ( "quantization_type" ) and op_node . op ( ) . attr ( "quantization_type" ) == "qat_with_weight" : for var_node in op_node . inputs : name = var_node . name ( ) if name in persistable_vars : if name not in input_map : int8_var_node = self . _convert_to_int8 ( graph , var_node ) input_map [ name ] = int8_var_node graph . update_input_link ( var_node , input_map [ name ] , op_node ) # remove the unused var node in the graph self . _remove_unused_var_nodes ( graph ) graph . resolve_hazard ( ) return graph