def _find_duplicate_initializers(
    models: list[ModelProto],
) -> defaultdict[tuple[int, str, tuple], set[tuple[str, int]]]:
    """Create a map (unique data) --> set of (initializer name, model id).

    Initializers with a dimension 0, or dimension 1 with data type int32 or int64, are not included in the
    generated map.
    """
    duplicates: defaultdict[tuple[int, str, tuple], set[tuple[str, int]]] = defaultdict(set)
    for i in range(len(models)):
        for initializer in models[i].graph.initializer:
            tensor_dims = tuple(initializer.dims)
            if (len(tensor_dims) > 1) or (
                (len(tensor_dims) == 1) and (initializer.data_type not in [TensorProto.INT32, TensorProto.INT64])
            ):
                # Extract tensor data as numpy array
                tensor_data: NDArray = onnx.numpy_helper.to_array(initializer)

                # Hash tensor data to avoid storing large amounts of data in memory
                hashed = hashlib.sha512()
                hashed.update(tensor_data)
                tensor_digest = hashed.hexdigest()

                duplicates[(initializer.data_type, tensor_digest, tensor_dims)].add((initializer.name, i))

    return duplicates
Create a map (unique data) --> set of (initializer name, model id).

    Initializers with a dimension 0, or dimension 1 with data type int32 or int64, are not included in the
    generated map.
    
olive/passes/onnx/merge_decoders.py