def update_dimension(model, input_dimension):
    """
    Given a model that takes an array of dimension input_dimension, returns
    the output dimension.
    """
    if not (_HAS_SKLEARN):
        raise RuntimeError(
            "scikit-learn not found. scikit-learn conversion API is disabled."
        )

    if _SKLEARN_VERSION >= Version("0.22"):
        _sklearn_util.check_fitted(model, lambda m: hasattr(m, "categories_"))
        _sklearn_util.check_fitted(model, lambda m: hasattr(m, "n_features_in_"))
        return sum(model._n_features_outs)
    else:
        _sklearn_util.check_fitted(model, lambda m: hasattr(m, "active_features_"))
        _sklearn_util.check_fitted(model, lambda m: hasattr(m, "n_values_"))

        if model.categorical_features == "all":
            return len(model.active_features_)
        else:
            out_dimension = len(model.active_features_) + (
                input_dimension - len(model.n_values_)
            )

            return out_dimension

    Given a model that takes an array of dimension input_dimension, returns
    the output dimension.
    
coremltools/converters/sklearn/_one_hot_encoder.py