def _fix_output_shapes(model_proto: onnx.ModelProto):
    """Run shape inference on the model and update the output shapes to make them fixed."""
    from onnxruntime.tools.onnx_model_utils import is_fixed_size_tensor
    from onnxruntime.tools.symbolic_shape_infer import SymbolicShapeInference

    # use the onnxruntime shape inference tool since it can handle large models as well as contrib ops
    inferred_proto = SymbolicShapeInference.infer_shapes(model_proto, auto_merge=True, guess_output_rank=True)

    for idx, o in enumerate(model_proto.graph.output):
        if not is_fixed_size_tensor(o):
            new_o = inferred_proto.graph.output[idx]
            if is_fixed_size_tensor(new_o):
                o.type.tensor_type.shape.CopyFrom(new_o.type.tensor_type.shape)
Run shape inference on the model and update the output shapes to make them fixed.
olive/passes/onnx/common.py