code: def _convert_xgboost(
      model, backend, test_input, device, extra_config={}
  ):
      """
      This function is used to generate a *backend* model from a given input [XGBoost] model.
      [XGBoost]: https://xgboost.readthedocs.io/
      """
      assert_xgboost_installed()
  
      # XGBoostRegressor and Classifier have different APIs for extracting the number of features.
      # In the former case we need to infer them from the test_input.
      booster = (
          model.get_booster()
          if hasattr(model, "get_booster")
          else model
      )
      if hasattr(booster, "num_features"):
          extra_config[constants.N_FEATURES] = booster.num_features()
      elif "_features_count" in dir(model):
          extra_config[constants.N_FEATURES] = model._features_count
      elif test_input is not None:
          if (
              type(test_input) is np.ndarray
              and len(test_input.shape) == 2
          ):
              extra_config[constants.N_FEATURES] = test_input.shape[1]
          else:
              raise RuntimeError(
                  "XGBoost converter is not able to infer the number of input features.\
                      Please pass a test_input to convert or \
                      fill an issue at https://github.com/microsoft/hummingbird/."
              )
      else:
          raise RuntimeError(
              "XGBoost converter is not able to infer the number of input features.\
                  Please pass some test_input to the converter."
          )
      return _convert_sklearn(
          model, backend, test_input, device, extra_config
      )
  
imports: from copy import deepcopy
  import psutil
  import numpy
  from .operator_converters import constants
  from ._parse import parse_sklearn_api_model, parse_onnx_api_model, parse_sparkml_api_model
  from ._topology import convert
  from ._utils import assert_torch_installed, assert_lightgbm_installed, assert_xgboost_installed, pandas_installed, sparkml_installed, is_pandas_dataframe, is_spark_dataframe, tvm_installed
  from .exceptions import MissingConverter, MissingBackend
  from .supported import backends
  from sklearn.utils import all_estimators
  from sklearn.utils.validation import check_is_fitted
  from .None import operator_converters
  from .supported import xgb_operator_list
  from .supported import lgbm_operator_list
label_desc: Use image node_id 7 for calling a global function with example usage: _convert_xgboost(model, backend, test_input, device, extra_config) and returns: _convert_sklearn