examples/research_projects/onnx/summarization/bart_onnx/reduce_onnx_size.py/_remove_dup_initializers_from_model
def _remove_dup_initializers_from_model(model, model_without_ext, ind_to_replace):
    inits_with_data = list(model.graph.initializer)
    inits = list(model_without_ext.graph.initializer)
    for i, ref_i in ind_to_replace:
        assert inits_with_data[i].name == inits[i].name
        assert inits_with_data[ref_i].name == inits[ref_i].name
        assert i > ref_i

        name_i = inits[i].name
        name_ref = inits[ref_i].name

        model_without_ext.graph.initializer.remove(inits[i])

        # for n in model.graph.node:
        _graph_replace_input_with(model_without_ext.graph, name_i, name_ref)