def remove_feed_fetch_op(program):
    """ remove feed and fetch operator and variable for fine-tuning
    """
    block = program.global_block()
    need_to_remove_op_index = []
    for i, op in enumerate(block.ops):
        if op.type == 'feed' or op.type == 'fetch':
            need_to_remove_op_index.append(i)
    for index in need_to_remove_op_index[::-1]:
        block._remove_op(index)
    need_to_remove_var = []
    for var in block.vars:
        if var.endswith('feed'):
            need_to_remove_var.append(var)
        if var.endswith('fetch'):
            need_to_remove_var.append(var)
    for var in need_to_remove_var:
        block._remove_var(var)
    program.desc.flush()
