code: def convert_sklearn_gbdt_classifier(operator, device, extra_config):
      """
      Converter for `sklearn.ensemble.GradientBoostingClassifier`
  
      Args:
          operator: An operator wrapping a `sklearn.ensemble.GradientBoostingClassifier`
                    or `sklearn.ensemble.HistGradientBoostingClassifier` model
          device: String defining the type of device the converted operator should be run on
          extra_config: Extra configuration used to select the best conversion strategy
  
      Returns:
          A PyTorch model
      """
      assert operator is not None, "Cannot convert None operator"
  
      # Get tree information out of the operator.
      tree_infos = operator.raw_operator.estimators_
      # GBDT does not scale the value using the learning rate upfront, we have to do it.
      extra_config[
          constants.LEARNING_RATE
      ] = operator.raw_operator.learning_rate
      # GBDT does not normalize values upfront, we have to do it.
      extra_config[
          constants.GET_PARAMETERS_FOR_TREE_TRAVERSAL
      ] = get_parameters_for_tree_trav_sklearn
  
      n_features = _get_n_features(operator.raw_operator)
      classes = operator.raw_operator.classes_.tolist()
      n_classes = len(classes)
  
      # Analyze classes.
      if not all(isinstance(c, int) for c in classes):
          raise RuntimeError(
              "GBDT Classifier translation only supports integer class labels."
          )
      if n_classes == 2:
          n_classes -= 1
  
      # Reshape the tree_infos into hummingbird gbdt internal format.
      tree_infos = [
          tree_infos[i][j]
          for j in range(n_classes)
          for i in range(len(tree_infos))
      ]
  
      # Get the value for Alpha.
      if hasattr(operator.raw_operator, "init"):
          if operator.raw_operator.init == "zero":
              base_prediction = [[0.0]]
          elif operator.raw_operator.init is None:
              if n_classes == 1:
                  base_prediction = [
                      [
                          np.log(
                              operator.raw_operator.init_.class_prior_[
                                  1
                              ]
                              / (
                                  1
                                  - operator.raw_operator.init_.class_prior_[
                                      1
                                  ]
                              )
                          )
                      ]
                  ]
              else:
                  base_prediction = [
                      [
                          np.log(
                              operator.raw_operator.init_.class_prior_[
                                  i
                              ]
                          )
                          for i in range(n_classes)
                      ]
                  ]
          else:
              raise RuntimeError(
                  "Custom initializers for GBDT are not yet supported in Hummingbird."
              )
      elif hasattr(operator.raw_operator, "_baseline_prediction"):
          if n_classes == 1:
              base_prediction = [
                  [operator.raw_operator._baseline_prediction]
              ]
          else:
              base_prediction = np.array(
                  [
                      operator.raw_operator._baseline_prediction.flatten().tolist()
                  ]
              )
  
      extra_config[constants.BASE_PREDICTION] = base_prediction
      extra_config[constants.REORDER_TREES] = False
  
      return convert_gbdt_classifier_common(
          operator,
          tree_infos,
          get_parameters_for_sklearn_common,
          n_features,
          n_classes,
          classes,
          extra_config,
      )
  
file_path: hummingbird/hummingbird/ml/operator_converters/sklearn/gbdt.py
imports: import numpy
  from onnxconverter_common.registration import register_converter
  from ..None import constants
  from .._gbdt_commons import convert_gbdt_common, convert_gbdt_classifier_common
  from .._tree_commons import get_parameters_for_sklearn_common, get_parameters_for_tree_trav_sklearn, TreeParameters
label_desc: Use image node_id 3 for calling a global function with example usage: convert_sklearn_gbdt_classifier(operator, device, extra_config) and returns: convert_gbdt_classifier_common