def promote_input_dtypes(input_vars):
    """
    This utility function promotes all input variables to the same data type.
    It is used to homogenize inputs to an op such as matmul / elementwise_binary,
    and not the inputs to a function itself.
    """
    def _is_same_dtype(dtype1, dtype2):
        return builtin_to_string(dtype1) == builtin_to_string(dtype2)

    def _promoted_var(var, promoted_dtype):
        if var.val is None:
            x = mb.cast(
                x=var, dtype=builtin_to_string(promoted_dtype), name=var.name + "_promoted")
        else:
            const_value_after_cast = cast_op_class.get_cast_value(var, builtin_to_string(promoted_dtype))
            x = mb.const(val=const_value_after_cast, name=var.name + "_promoted")
        return x

    for i, var in enumerate(input_vars):
        if not isinstance(var, Var):
            input_vars[i] = mb.const(val=var)

    promoted_dtype = promote_dtypes([var.dtype for var in input_vars])

    for i, var in enumerate(input_vars):
        if not _is_same_dtype(var.dtype, promoted_dtype):
            input_vars[i] = _promoted_var(var, promoted_dtype)

    return input_vars

    This utility function promotes all input variables to the same data type.
    It is used to homogenize inputs to an op such as matmul / elementwise_binary,
    and not the inputs to a function itself.
    
coremltools/converters/mil/mil/ops/defs/_utils.py