parameters: (checkpoint_from_path,
                    checkpoint_to_path,
                    write_v1_checkpoint=False)
return_statement: return new_variable_map, conversion_map
docstring: Migrates the names of variables within a checkpoint.
  
    Args:
      checkpoint_from_path: Path to source checkpoint to be read in.
      checkpoint_to_path: Path to checkpoint to be written out.
      write_v1_checkpoint: Whether the output checkpoint will be in V1 format.
  
    Returns:
      A dictionary that maps the new variable names to the Variable objects.
      A dictionary that maps the old variable names to the new variable names.
docstring_summary: Migrates the names of variables within a checkpoint.
docstring_tokens: Migrates the names of variables within a checkpoint .
function: def convert_names(checkpoint_from_path,
                    checkpoint_to_path,
                    write_v1_checkpoint=False):
    """Migrates the names of variables within a checkpoint.
  
    Args:
      checkpoint_from_path: Path to source checkpoint to be read in.
      checkpoint_to_path: Path to checkpoint to be written out.
      write_v1_checkpoint: Whether the output checkpoint will be in V1 format.
  
    Returns:
      A dictionary that maps the new variable names to the Variable objects.
      A dictionary that maps the old variable names to the new variable names.
    """
    with ops.Graph().as_default():
      logging.info('Reading checkpoint_from_path %s' % checkpoint_from_path)
      reader = pywrap_tensorflow.NewCheckpointReader(checkpoint_from_path)
      name_shape_map = reader.get_variable_to_shape_map()
      not_sharded, sharded = _split_sharded_vars(name_shape_map)
      new_variable_map = {}
      conversion_map = {}
      for var_name in not_sharded:
        new_var_name = _rnn_name_replacement(var_name)
        tensor = reader.get_tensor(var_name)
        var = variables.Variable(tensor, name=var_name)
        new_variable_map[new_var_name] = var
        if new_var_name != var_name:
          conversion_map[var_name] = new_var_name
      for var_name in sharded:
        new_var_name = _rnn_name_replacement_sharded(var_name)
        var = variables.Variable(tensor, name=var_name)
        new_variable_map[new_var_name] = var
        if new_var_name != var_name:
          conversion_map[var_name] = new_var_name
  
      write_version = (saver_pb2.SaverDef.V1
                       if write_v1_checkpoint else saver_pb2.SaverDef.V2)
      saver = saver_lib.Saver(new_variable_map, write_version=write_version)
  
      with session.Session() as sess:
        sess.run(variables.global_variables_initializer())
        logging.info('Writing checkpoint_to_path %s' % checkpoint_to_path)
        saver.save(sess, checkpoint_to_path)
  
    logging.info('Summary:')
    logging.info('  Converted %d variable name(s).' % len(new_variable_map))
    return new_variable_map, conversion_map
function_tokens: def convert_names ( checkpoint_from_path , checkpoint_to_path , write_v1_checkpoint = False ) : with ops . Graph ( ) . as_default ( ) : logging . info ( 'Reading checkpoint_from_path %s' % checkpoint_from_path ) reader = pywrap_tensorflow . NewCheckpointReader ( checkpoint_from_path ) name_shape_map = reader . get_variable_to_shape_map ( ) not_sharded , sharded = _split_sharded_vars ( name_shape_map ) new_variable_map = { } conversion_map = { } for var_name in not_sharded : new_var_name = _rnn_name_replacement ( var_name ) tensor = reader . get_tensor ( var_name ) var = variables . Variable ( tensor , name = var_name ) new_variable_map [ new_var_name ] = var if new_var_name != var_name : conversion_map [ var_name ] = new_var_name for var_name in sharded : new_var_name = _rnn_name_replacement_sharded ( var_name ) var = variables . Variable ( tensor , name = var_name ) new_variable_map [ new_var_name ] = var if new_var_name != var_name : conversion_map [ var_name ] = new_var_name write_version = ( saver_pb2 . SaverDef . V1 if write_v1_checkpoint else saver_pb2 . SaverDef . V2 ) saver = saver_lib . Saver ( new_variable_map , write_version = write_version ) with session . Session ( ) as sess : sess . run ( variables . global_variables_initializer ( ) ) logging . info ( 'Writing checkpoint_to_path %s' % checkpoint_to_path ) saver . save ( sess , checkpoint_to_path ) logging . info ( 'Summary:' ) logging . info ( '  Converted %d variable name(s).' % len ( new_variable_map ) ) return new_variable_map , conversion_map